Re: [vibration] Require user activation for navigator.vibrate (#29)

User activation has had a long history in spec land AFAIR, and it is currently specified in https://html.spec.whatwg.org/multipage/interaction.html#tracking-user-activation

We are probably interested in the [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation) boolean flag, which [several specs](https://dontcallmedom.github.io/webdex/t.html#Transient%20activation%40%40html%25%25dfn) seem to check for at this point.

https://w3c.github.io/pointerlock/#dom-element-requestpointerlock says _"Pointer lock is a [transient activation-gated API](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation-gated-api), therefore a [requestPointerLock](https://w3c.github.io/pointerlock/#dom-element-requestpointerlock)() call MUST fail if the [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global) of [this](https://webidl.spec.whatwg.org/#this) does not have [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation). This prevents locking upon initial navigation or re-acquiring lock without user's attention."_.

The language used in algorithms in other specs (e.g. https://w3c.github.io/remote-playback/#prompt-user-for-changing-remote-playback-state or https://wicg.github.io/eyedropper-api/#dom-eyedropper-open) looks like this: _"If the [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global) of [this](https://webidl.spec.whatwg.org/#this) does not have [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation), return [a new promise](https://webidl.spec.whatwg.org/#a-new-promise) [rejected](https://webidl.spec.whatwg.org/#reject) with a "[NotAllowedError](https://webidl.spec.whatwg.org/#notallowederror)" [DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)."_

-- 
GitHub Notification of comment by rakuco
Please view or discuss this issue at https://github.com/w3c/vibration/issues/29#issuecomment-1118409650 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 5 May 2022 10:42:36 UTC