feat: add a way to disable haptics in Ionic components
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
I would like an option to turn off Ionic's built-in haptics.
Describe the Use Case
Users would like an option to turn off all app haptics. Right now it is impossible to turn off Ionic's built-in haptics.
Describe Preferred Solution
setupIonicReact({ haptics: false })
Describe Alternatives
Not an alternative, but a complimentary feature request: it would be nice if Ionic emitted an ionHaptic event (or similar). Such an event would fire regardless of whether setupIonicReact({ haptics: false }) is configured or not. This would lets apps dynamically turn on/off haptics, use custom capacitor haptics libraries, and even disable haptics for certain components (with event.target).
| Configuration | Built-in haptics triggered? | Ionic event triggered (ionHaptic)? |
|---|---|---|
setupIonicReact({ haptics: true }) AKA default |
Yes | Yes |
setupIonicReact({ haptics: false }) |
No | Yes |
If Ionic is interested in this, I am happy to create a separate feature request.
Related Code
No response
Additional Information
https://github.com/aeharding/voyager/issues/1103
Thanks for the request. Can you help me understand why you'd like to disable the haptics?
Thanks for the request. Can you help me understand why you'd like to disable the haptics?
This is a user request I've had a few times, mainly from Android users due to Android haptics being very inconsistent between vendors (and sometimes too strong or weak).
It is currently a setting you can change in Voyager, but only affects Voyager's custom haptics (hence this issue).
Edit: To be clear, disabling haptics is a setting in Voyager users can set if they don't like haptics for whatever reason. Only a small subset of users don't like haptics. Haptics are on by default.
Thanks for the added info. Is this a problem when changing the haptics preference via a system setting too? On https://github.com/aeharding/voyager/issues/1103 it sounded like turning haptics off in the Android Settings app wasn't actually disabling haptics.
I tested on my end and disabling haptics from the Settings app does disabled haptics.
That user is referring to a Voyager app setting, not phone setting :)
Perfect, thanks! I think this is a good feature to have. The team has some concerns about placing this option in the IonicConfig (since the config is not reactive), so we'll need to do some design work first.