Skip to content

[focusgroup] Add the focusgroup attribute - #11723

Open
janewman wants to merge 133 commits into
whatwg:mainfrom
janewman:focusgroup
Open

janewman wants to merge 133 commits into
whatwg:mainfrom
janewman:focusgroup

Conversation

@janewman

@janewman janewman commented Sep 29, 2025 •

Copy link
Copy Markdown

#11641

This adds the focusgroup attributes needed to allow for declarative focus navigation using the directional navigation (arrow keys, d-pad).
This specs the behavior detailed in the explainer on OpenUI.


/dom.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )

@janewman
janewman marked this pull request as ready for review November 24, 2025 17:33
@janewman

Copy link
Copy Markdown
Author

Opening up for review, but please keep in mind this is an early draft.

@janewman

Copy link
Copy Markdown
Author

@annevk, during TPAC you expressed interest in taking a look at this draft spec change - I would really appreciate any feedback you had as I work to move this towards something we think accurately captures the behavior and fits in with the existing logic.
Thanks!

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
@smaug----

Copy link
Copy Markdown

It is unclear to me what happens if the page has keydown, or keyup event listener and calls preventDefault() when arrow key is used. Which event listener has some affect and which doesn't?
What if some modifier is used with the key event?

…ng section, improve segment definition with example, and simplify key conflict element handling
@janewman

janewman commented Feb 2, 2026

Copy link
Copy Markdown
Author

It is unclear to me what happens if the page has keydown, or keyup event listener and calls preventDefault() when arrow key is used. Which event listener has some affect and which doesn't? What if some modifier is used with the key event?

I've added a new section that should answer all of these questions, please let me know what you thank and if it still isn't clear.
Thanks for all of the feedback, it is very much appreciated!!

@janewman
janewman requested a review from smaug---- February 2, 2026 23:39
- Lowercase the focusgroup attribute value upfront in the state
  algorithm (matches the blocking attribute pattern), so subsequent
  token comparisons are exact
- Use linked Directional Navigation references in concept-related
  prose (modifier table descriptions, attributes index, examples)
- Drop tutorial-style "Each segment operates independently" bullets
  and the inaccurate horizontal-scrolling bullet from examples
- Replace "enables" with "provides" in opening attribute definition;
  trim "automatically configure the correct axis and wrapping" from
  menubar example intro
@janewman

Copy link
Copy Markdown
Author

It seems the Build is failing. It also seems that this PR needs significant integration work with the various accessibility specifications. Has any progress been made on that front? In particular I'm not sure ARIA role inference should be specified here. We don't define that for HTML elements either today.

I've stripped out the ARIA sections from here, these concepts will live in w3c/aria#2778

@janewman

Copy link
Copy Markdown
Author

This isn't a full review, because I think some of my commentary may have broader impacts on this spec, but here's what I have so far:

Really appreciate the feedback!

Let me know what you think of the latest.

janewman added 2 commits May 22, 2026 03:29
- Wrap: use "exactly one of nowrap or wrap" framing so non-conforming
  (both present) falls into the same "otherwise" branch as neither,
  using the behavior default
- Axis: state directly that both inline and block means Directional
  Navigation operates on both axes; reword DN's axis check to test
  whether effective modifiers restrict DN to an axis other than the
  one being navigated, rather than testing for a specific opposite
  token in the effective modifier set
- Trim "What to notice" in tablist example to a single terse paragraph
- Use "focus group" (concept) consistently in prose where "focusgroup"
  referred to the concept rather than the attribute
- Drop non-keyboard-modifier-key note (UA discretion is implicit)
lukewarlow pushed a commit to openui/open-ui that referenced this pull request May 26, 2026
…e first token (#1450)

* [focusgroup] Update explainer to match whatwg/html#11723

Aligns the explainer's Feature detection section with the IDL
landed in whatwg/html#11723: focusGroup as a DOMTokenList and
focusGroupStart as a boolean, both on the HTMLOrSVGElement mixin.
Adds a short DOMTokenList ergonomics example so authors know they can
use .add/.toggle/.contains/.remove rather than parsing the attribute
value. Links the WHATWG PR from the intro metadata and refreshes the
Last updated date.

* fixup: align Feature detection prose with new IDL casing

Customs review iteration 1: prose at line 837 referred to a
`focusgroup` property (lowercase) but the IDL the previous commit
introduced declares `focusGroup` (camelCase) and adds a separate
`focusGroupStart` boolean. Rewrites the sentence to name both IDL
properties correctly and distinguish them from the content-attribute
names. Adds one bridging sentence noting that direct string
assignment continues to work alongside the DOMTokenList methods.

* fixup: reword string-assignment note for register

Customs review iteration 2: RR1 (spec-accuracy) and RR3 (prose-voice)
independently flagged "still works" as conversational and as assuming
the reader knew the prior DOMString IDL. Rewrites the sentence in the
spec-adjacent register used by the rest of the section.

* fixup: remove DOMTokenList ergonomics section

Drops the per-token API discussion (Because focusGroup is a DOMTokenList...
plus the JS example) and the readonly/PutForwards string-assignment note.
Both patterns are well known to authors who reach for the IDL, and removing
them keeps the Feature detection section focused on the new IDL surface.

* fixup: drop enforced token-order claims

Token order in the focusgroup attribute is not significant per the spec
PR algorithm — only the SET of tokens matters. The explainer previously
implied an order requirement in several places (mostly via "first token"
phrasings used to mean "the behavior token"). Replaces those with
"behavior token" where the meaning was semantic, drops the explicit
"Order: first token MUST be ..." claim in the Index of focusgroup
values, softens the Authoring guidance "Put the behavior token first"
imperative to a readability recommendation, and notes "in any order" in
the Focusgroup tokens introduction.

* fixup: clarify token-order convention in Focusgroup tokens intro

The bracket notation immediately after the intro sentence shows tokens
in a conventional order (behavior, axis, wrap, memory); the rewritten
intro labels that order as conventional and explicitly states any
order is valid.
beckysiegel pushed a commit to chromium/chromium that referenced this pull request May 27, 2026
Align the focusgroup attribute parsing with the formal "determine the
focusgroup state" algorithm defined in the HTML spec PR:
whatwg/html#11723.

With this change, "none" and the behavior token can appear at any
position. Before, the these were required to be the first token or
parsing would fire an error.

Bug: 40210717
Change-Id: Ic258d4fc39f9850c5cabac2b4afa0dbcf6c32d95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7871960
Commit-Queue: Jacques Newman <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1637192}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 28, 2026
Align the focusgroup attribute parsing with the formal "determine the
focusgroup state" algorithm defined in the HTML spec PR:
whatwg/html#11723.

With this change, "none" and the behavior token can appear at any
position. Before, the these were required to be the first token or
parsing would fire an error.

Bug: 4021071
Change-Id: Ic258d4fc39f9850c5cabac2b4afa0dbcf6c32d95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7871960
Commit-Queue: Jacques Newman <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1637192}
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jun 2, 2026
…latest spec draft, a=testonly

Automatic update from web-platform-tests
[focusgroup] Align ParseFocusgroup with latest spec draft

Align the focusgroup attribute parsing with the formal "determine the
focusgroup state" algorithm defined in the HTML spec PR:
whatwg/html#11723.

With this change, "none" and the behavior token can appear at any
position. Before, the these were required to be the first token or
parsing would fire an error.

Bug: 40210717
Change-Id: Ic258d4fc39f9850c5cabac2b4afa0dbcf6c32d95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7871960
Commit-Queue: Jacques Newman <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1637192}

--

wpt-commits: ea921feb8d626629aebe857e774864f8679f0977
wpt-pr: 60231

@keithamus keithamus 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.

Some high level commentary. I will be back with more tomorrow.

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved

@keithamus keithamus 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.

Okay, another review pass, this time checking against tests. I think I see some ambiguities or at least clarifications.

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
@janewman

Copy link
Copy Markdown
Author

Okay, another review pass, this time checking against tests. I think I see some ambiguities or at least clarifications.

Really appreciate the review feedback! I'll be leaving for vacation at the end of this week but I'll try to push an update to address these before then. if I don't this will definitely be one of my priorities when I return. Apologies in advance for any delays on my part!

@annevk

annevk commented Aug 20, 2026

Copy link
Copy Markdown
Member

@janewman https://gist.github.com/annevk/3dc3459e443cdb515c34692f0f8d3406 has an AI review of this feature. (I haven't checked it in detail, but it seems to be mostly doing a good job at identifying real problems across a wide variety of HTML PRs.)

zerox80 pushed a commit to zerox80/firefox that referenced this pull request Oct 16, 2026
…latest spec draft, a=testonly

Automatic update from web-platform-tests
[focusgroup] Align ParseFocusgroup with latest spec draft

Align the focusgroup attribute parsing with the formal "determine the
focusgroup state" algorithm defined in the HTML spec PR:
whatwg/html#11723.

With this change, "none" and the behavior token can appear at any
position. Before, the these were required to be the first token or
parsing would fire an error.

Bug: 40210717
Change-Id: Ic258d4fc39f9850c5cabac2b4afa0dbcf6c32d95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7871960
Commit-Queue: Jacques Newman <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1637192}

--

wpt-commits: ea921feb8d626629aebe857e774864f8679f0977
wpt-pr: 60231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.