Re: [w3c/gamepad] Trigger HTML activation (PR #230)

saschanaz left a comment (w3c/gamepad#230)

> This also matches existing shipped behavior: Chromium calls LocalFrame::NotifyUserActivation(kInteraction) from NavigatorGamepad::Gamepads() whenever GamepadComparisons::Compare()

I don't think it actually matches the Chrome behavior. This line corresponds to [this code](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc;l=131-138;drc=dd96078280fa13ebb2074918373b29dde1b18462), but that's `navigator.getGamepads()`, which is the sole caller of `GamepadComparisons::HasUserActivation`. The logic there is:

1. If `navigator.getGamepads()` is called
2. And the button is pressed when it's called
3. Then notify it as user activation

This is super weird, if you check `navigator.userActivation` on `ongamepadconnected` event and press gamepad button to trigger connection, it stays false. But if you call getGamepads (from anywhere e.g. in setInterval) then it turns to true. I don't think any existing API works this way.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/230#issuecomment-6769957152
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/gamepad/pull/230/c6769957152@github.com>

Received on Tuesday, 10 November 2026 14:29:46 UTC