interop
interop copied to clipboard
Vibration API
Description
Haptics are vital to games + professional feel of buttons, switches, and other user input for mobile/tablet web.
Since Vibration API's inception on Android (launched in Firefox, 12 years ago), I haven't heard of a single real user complaint. Reasonable guardrails on Vibration API are welcome.
iOS 18.0 WebKit has added non-standard haptics to switch checkbox elements (and only to switch inputs?) displaying a need for haptics and how incongruous it is to exclude haptics from touch devices on the web.
Specification
https://www.w3.org/TR/vibration/
Additional Signals
https://stackoverflow.com/questions/56926591/navigator-vibrate-break-the-code-on-ios-browsers
Note that WebKit actively opposes this API, so it's very unlikely that this will get accepted for Interop.
@BenjaminAster They've added haptics to switch elements for iOS Safari 18.0 so maybe they're ready to reconsider.
At Jackbox Games we use vibration on supported browsers to enhance the playability of our games. Players interact with the games via the website jackbox.tv. Vibration is used to let players know it's their turn, Provide notification-like event feedback and other quality-of-life improvements to gameplay. (For more context on how our games use a website as a controller for console/PC games, see here: https://www.jackboxgames.com/how-to-play)
This would be useful for games made in Construct so we support this.
Additional interop-related frustration signals:
- reddit.com/r/webdev: Vibration API in Safari iOS (+139)
- reddit.com/r/webdev: Apple should enable haptic/vibration on safari (+23)
- reddit.com/r/webdev: Vibrations on Safari (+8)
- reddit.com/r/Frontend: Are there any Haptic feedback API's available for mobile-web? (+4)
- Firefox bug: navigator.vibrate() doesn't work anymore
WebKit remain firmly against this API. The API is too limited and won't give developers the haptics they need (i.e., this not an iterop issue). The web needs better haptics support, but Vibration API is not the solution. This will require some new solution, which will require incubation and standardization.
For gamepad haptics, please use the gamepad API.
iOS 18.0 WebKit has added non-standard haptics to switch checkbox elements
Note that it's not correct to say these are "non-standard", as they may be following OS/platform convention for the switch/input types. Also, there's nothing in HTML (AFAIK) that defines how inputs should "feel" vs how they look - and even for how they look, that's also left up to the platform.
There is no web standard for adding switch attribute to an input apart from WebKit announcing it.
I don't think the absence of "haptics" or "sound" (or some other unnamed dimension) in a standard means that those are fair game by the platform. Especially if there is no way to clear or modify the additional dimension like we have for appearance.
Thank you for proposing Vibration API for inclusion in Interop 2025.
We wanted to let you know that this proposal was not selected to be part of Interop this year.
On behalf of the entire Interop team, thank you for submitting this proposal for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.
For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2025.
Posted on behalf of the Interop team.