Skip to content

Require system focus for gamepad user gesture#207

Merged
marcoscaceres merged 7 commits into
gh-pagesfrom
gesture-requires-focus
May 15, 2026
Merged

Require system focus for gamepad user gesture#207
marcoscaceres merged 7 commits into
gh-pagesfrom
gesture-requires-focus

Conversation

@nondebug

@nondebug nondebug commented May 10, 2024

Copy link
Copy Markdown
Collaborator

Closes #206

The following tasks have been completed:

  • Modified Web platform tests (link to pull request)

Implementation commitment:


Preview | Diff

@marcoscaceres

Copy link
Copy Markdown
Member

This seems reasonable. I need to check if WebKit already does this or not.

@nondebug

Copy link
Copy Markdown
Collaborator Author

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.

@marcoscaceres

marcoscaceres commented Aug 8, 2024

Copy link
Copy Markdown
Member

We might actually want this:
https://html.spec.whatwg.org/multipage/interaction.html#fully-active-descendant-of-a-top-level-traversable-with-user-attention

  • Fully active
  • visibly requirement
  • and system system focus!

@marcoscaceres marcoscaceres left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok to me.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Document lookup 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.

Comment thread index.html
Comment thread index.html Outdated
Comment on lines +2116 to +2117
<li>Let |gamepads:sequence&lt;Gamepad?&gt;| be an empty [=list=].
</li>

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<li>Let |gamepads:sequence&lt;Gamepad?&gt;| be an empty [=list=].
</li>

Copilot uses AI. Check for mistakes.
Comment thread index.html
Comment thread index.html
Comment thread index.html
Comment thread index.html Outdated

@gabrielsanbrito gabrielsanbrito left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marcoscaceres marcoscaceres merged commit 81ad075 into gh-pages May 15, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require focus for initial gamepad user gesture

4 participants