web-platform-tests / interop

web-platform-tests Interop project
https://wpt.fyi/interop
319 stars 27 forks source link

Vibration API #718

Open shalanah opened 2 months ago

shalanah commented 2 months ago

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

BenjaminAster commented 2 months ago

Note that WebKit actively opposes this API, so it's very unlikely that this will get accepted for Interop.

shalanah commented 2 months ago

@BenjaminAster They've added haptics to switch elements for iOS Safari 18.0 so maybe they're ready to reconsider.

evanjacover commented 1 month ago

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)

AshleyScirra commented 1 month ago

This would be useful for games made in Construct so we support this.

nondebug commented 1 month ago

Additional interop-related frustration signals:

marcoscaceres commented 1 month ago

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.

marcoscaceres commented 1 month ago

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.

shalanah commented 1 month ago

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.