Require system focus for gamepad user gesture#207
Conversation
|
This seems reasonable. I need to check if WebKit already does this or not. |
I think WebKit on macOS already requires focus even for normal gamepad inputs because it uses Game Controller API which requires focus. |
|
We might actually want this:
|
There was a problem hiding this comment.
Pull request overview
Updates the Gamepad spec’s “gamepad user gesture” handling to require the relevant document to have user attention (i.e., be focused/active) before the initial gesture unlocks exposure of gamepad data, addressing issue #206’s cross-tab gesture concerns.
Changes:
- Gate setting
Navigator/[[hasGamepadGesture]]on the associated document being a fully active descendant of a top-level traversable with user attention. - Hoist the associated
Documentlookup earlier in the “update gamepad state” algorithm (so it can be used for the new focus/user-attention check).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <li>Let |gamepads:sequence<Gamepad?>| be an empty [=list=]. | ||
| </li> |
There was a problem hiding this comment.
This algorithm step is duplicated: Let |gamepads:sequence<Gamepad?>| be an empty list appears twice in a row. Remove the extra step to avoid confusion about variable re-declaration and keep the algorithm consistent.
| <li>Let |gamepads:sequence<Gamepad?>| be an empty [=list=]. | |
| </li> |
Closes #206
The following tasks have been completed:
Implementation commitment:
Preview | Diff