Skip to content

Trigger HTML activation#230

Open
jesup wants to merge 1 commit into
w3c:gh-pagesfrom
jesup:push-xzzosowtzpoz
Open

Trigger HTML activation#230
jesup wants to merge 1 commit into
w3c:gh-pagesfrom
jesup:push-xzzosowtzpoz

Conversation

@jesup

@jesup jesup commented Jul 10, 2026

Copy link
Copy Markdown

Closes #124

This combines gamepad interaction with HTML's existing sticky/transient activation (https://html.spec.whatwg.org/#tracking-user-activation) model, per @marcoscaceres's review on #107 ("we probably want to layer this on top of HTML's 'triggered by user activation'") and this issue's suggestion to use the sticky-activation model directly, rather than defining a new gamepad-local activation concept as #107 attempted (that PR duplicated the existing spec's "contains a gamepad user gesture" definition under a colliding name and never reached HTML's real activation state -- I suggest closing it in favor of this PR).

This also matches existing shipped behavior: Chromium calls LocalFrame::NotifyUserActivation(kInteraction) from NavigatorGamepad::Gamepads() whenever GamepadComparisons::Compare() detects a qualifying button/axis transition on a visible page -- the same primitive mouse/keyboard input uses. This PR gives that behavior normative text, reusing the spec's existing "contains a gamepad user gesture" and fully active descendant of a top-level traversable with user attention conditions as the trigger, and HTML's activationnotification algorithm as the effect.

Note this extends HTML's own introduction of activation notification ("when a user interaction causes firing of an activation triggering input event... the user agent must perform the following steps before dispatching the event") — gamepad state changes aren't dispatched as that kind of event; they're observed by polling. I'm invoking the algorithm as a reusable procedure rather than a hard prerequisite check, consistent with how Chromium implements it (it calls the underlying primitive directly, not by synthesizing a fake input event). Flagging this for HTML editors in case they'd prefer activation-triggering-input-event itself be broadened instead of allowing direct invocation. I can change to that if requested.

Deliberately out of scope: the separate, older "gamepadconnected event" section (§17) has its own partially-duplicated algorithm with stale prose ("SHOULD be dispatched when the user presses a button or moves an axis") that looks like leftover text update gamepad state was meant to supersede. Left untouched here to keep this PR reviewable; worth a separate cleanup PR.

The following tasks have been completed:

Implementation commitment:


Preview | Diff

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.

Maybe use "sticky activation" model?

1 participant