-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(toggle): add iOS 18 haptic feedback #29945
feat(toggle): add iOS 18 haptic feedback #29945
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -312,7 +343,8 @@ export class Toggle implements ComponentInterface { | |||
[`toggle-${rtl}`]: true, | |||
})} | |||
> | |||
<label class="toggle-wrapper"> | |||
{this.renderFallbackHapticElements()} | |||
<label class="toggle-wrapper" onClick={this.onClick}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onClick
listener moved to label, without this change Host
was capturing clicks on the haptic <label>
too, not only on .toggle-wrapper
const { inputId } = this; | ||
const mode = getIonMode(this); | ||
|
||
if (hapticAvailable() || mode !== 'ios') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, we don't need these elements if Vibration API is available, because then hapticSelection()
will work.
Hi @thetaPC, could you take a look? Do you have any suggestions? Or can we get this merged? Can't wait to have haptic feedback on toggles in my PWA 😄 |
Hi @thetaPC, what's the status here? 😄 Can we get this merged? |
Hello! I've responded to the feature request for more information. As we work to determine the status of this request, I’ll be stepping back as a direct peer reviewer. Please know that this doesn’t reflect a lack of interest—we truly appreciate the effort behind it. |
…nto 29942-ios-18-toggle-haptic-feedback
…nto 29942-ios-18-toggle-haptic-feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor grammar nit you can take or leave, but looks good to me!
Co-authored-by: Shane <[email protected]>
@jedlikowski Thank you for the PR! Also congrats on your first PR with Ionic Framework!! |
Thanks for merging it @thetaPC 😄 I don't see most of my changes though in the final PR 😮 . I see that just I tried going to the preview linked in the automatic Vercel comment above and the haptic feedback was not triggered for me when clicking on the toggle, while it was in the original set of changes. |
@jedlikowski I used
You will need to test the haptics on a real physical device, especially since it needs to check if the device has haptics enabled. This follows how native iOS handles the toggle vibration. If you believe that this solution should be altered to handle other cases, then please open a new issue with use cases. |
Issue number: resolves #29942
What is the current behavior?
iOS 18 has haptics on toggles, making a vibration when the user taps on a toggle. However, Ionic Framework does not match the implementation.
What is the new behavior?
onClick
function for iOS mode only. This works when the iOS device has haptics enabled.Does this introduce a breaking change?
Other information
Dev build:
8.5.3-dev.11743549985.1c03dfea