You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Design system: Standardize Tab stop and composite focus indicators #80405
Currently, UI components across @wordpress/components and @wordpress/ui use several different styles to indicate focus.
What is your proposed solution?
I would like to see if we can consolidate to two different styles, based on whether the focus is a Tab stop (navigated with the Tab key) or a composite widget focus (navigated with arrow keys).
Aside from acting as a keyboard navigation cue (should I use tab or arrow keys?), another reason it's good to have two separate focus indicator types is that there are situations where both are shown at the same time. Namely, a combobox pattern:
If I understand your proposal, and the combobox seems like a good microcosm of it, it seems reasonable. But does the composite focus meet contrast ratios? Seems like that backdrop needs to meet 3:1 contrast against the white backdrop of inactive items, yes?
But does the composite focus meet contrast ratios?
That's fair. Should we pair it with a border? Another possibility might be to use a more prominent style for focus-visible type interactions, but keep this subtle background style for hover.
I like the style for hover, just worth being clear that it's not focus. I don't know about a border, I'd rather pair it with some other highlight indicator, a chevron or something like that. But since there's substantial overlap with the command palette design, which I know @fcoveram has worked on a lot with @senadir, and because of that, there might be design details there we can lift. Or to frame it differently, I would expect eventually any command palette design to converge with what we do here.
I'm starting to think we may need to revert to this stronger highlight style 🤔
In certain places like the Combobox, we can't distinguish between a focus and a focus-visible because the interactions don't involve "actual" focus (the actual focus remains on the combobox input field). So basically we need a single highlight style that meets contrast requirements.
Plus, I noticed that the "hint text" often used in these item popups won't have enough contrast against the lighter highlight color.
I vaguely remember I worked with @fcoveram where we decided to go with the lighter highlight color. Maybe it was because we were considering putting full checkbox indicators (instead of just checkmarks) in certain items at the time, and a stronger highlight color would collide with the checkbox color when checked. We since dropped this idea, so maybe we can go back to a solid highlight? Not sure I'm remembering correctly.
Just in terms of simplicity though, a border instead of a background color is probably the simplest because we don't have to think about color contrast for the content.
I'd be in favour of returning to stronger solid focus / hover styles, especially since it's in continuity with that we're already doing in the @wordpress/components package. It still leaves the doots open for future changes, if necessary
For completeness, I wanted to note that GitHub does, in fact, use different focus styles for "keyboard focus" vs "virtual focus", especially in scenarios when both are used (ie. comobox filtering a list, similarly to what was flagged earlier by @mirka ):
keyboard focus uses the outer ring
virtual focus uses a combination of background color (like the hover styles) + a special indicator.
I'm not saying that we have to do the same, but I wanted to point out that the example app we've been looking at actually handles virtual focus differently from keyboard focus.
(Also, separatley, note how the dialog trigger (ie the "Type" button) stays highlighted while the dialog is open)
For comobox filtering a list, I initially thought of two focus rings, but that derails the focus purpose and sets two elements at the same level. A hierarchical code would be better, so for that I'm thinking of the following:
Focus ring is set in the input.
When moving between popover items, the focus ring moves to the element the user is going through.
Start typing moves the focus back to the input.
Keeping the focus ring in the input sets the focus in just one control, so maybe the suggestion above works better for conveying that both interactions (move between options and type) work side by side.
I may be contradicting technical feasibility and not meeting accessibility requirements, so please take this suggestion lightly.
While testing the new Menu in DataViews I've noticed a style change: selected items no longer have the focus ring. I welcome this change and should help clarifying what parts of the library have menu semantics (navigate via arrows) and what others have dialog semantics (navigate via TAB), which was not clear before.
Before
After
For awareness, there's one component that still has menu semantics but uses the focus ring — list layout: navigating across items. We need selected items to be visually selected and we also need the current item to be visually distinct, so we landed on this back in the days:
While working on #82294, I also realized that the combination of neutral text over brand background is not guaranteed to always produce accessible combinations
Two better alternatives would be:
neutral background + neutral text (ie. near black text over light gray background, for the default theme, similar to what GitHub does)
neutral background + neutral text (ie. near black text over light gray background, for the default theme, similar #80405 (comment))
Does this option include having the focus ring "separately"? Like in this example, list layout: navigating across items
I guess that would be a third option, ie keeping the text/background colors unchanged + showing a focus ring. Although we'd still need to change text/background on hover
Another aspect to keep in mind is that there parts of the UI (list view, autocomplete) where we use background/fg color to indicate "selection" whlie we still use the ring to indicate "focus"
From the example above, the version in ListView looks slightly overloaded with the extra white ring. Don't have all the context of this change, but the version I see in 7.1 looks cleaner, IMO
Work happened in #82129 , the context was mostly for better focus ring visibility, especially in situations where the focused item was just before / after the selection:
If this is still too attention-grabbing for the general case, then I think we may need to lean into the custom logic approach, maybe even request better upstream support.
Are you suggesting to use the Spectrum-ish background gray color for both the hover and keyboard states? Then that doesn't really solve our contrast problem. The Spectrum gray is paired with a prominent blue focus ring for keyboard states to keep it accessible. For a background gray to be accessible (3:1) "on its own", it needs to be around #949494 or darker.
Thanks @mirka for the thorough explanation. Very clear.
As I look at the options, I keep interacting with the Editor to see how it would feel there, and the "Keyboard-only ring" version (option F) is the one that feels more consistent with the rest of the UI. The following flow is key to me so the decision is contextualized.
CleanShot.2026-10-22.at.11.14.32.mp4
Although I see an inconsistency between the examples in F section and the one from Fluent. The latter doesn't have a fill.
F section
Fluent
In aiming for consistency, the ring with 1.5px thickness and the brand tone is better than the one from Fluent. And regarding the offset alignment, it doesn't bother me given that the interaction moves styles the interactive elements and the eye focuses attention on where the highlight is moving to.
Activity
mirka commentedon Jul 17, 2026
Aside from acting as a keyboard navigation cue (should I use tab or arrow keys?), another reason it's good to have two separate focus indicator types is that there are situations where both are shown at the same time. Namely, a combobox pattern:
jasmussen commentedon Jul 20, 2026
If I understand your proposal, and the combobox seems like a good microcosm of it, it seems reasonable. But does the composite focus meet contrast ratios? Seems like that backdrop needs to meet 3:1 contrast against the white backdrop of inactive items, yes?
mirka commentedon Jul 20, 2026
That's fair. Should we pair it with a border? Another possibility might be to use a more prominent style for
focus-visibletype interactions, but keep this subtle background style for hover.jasmussen commentedon Jul 20, 2026
I like the style for hover, just worth being clear that it's not focus. I don't know about a border, I'd rather pair it with some other highlight indicator, a chevron or something like that. But since there's substantial overlap with the command palette design, which I know @fcoveram has worked on a lot with @senadir, and because of that, there might be design details there we can lift. Or to frame it differently, I would expect eventually any command palette design to converge with what we do here.
mirka commentedon Jul 28, 2026
I'm starting to think we may need to revert to this stronger highlight style 🤔
In certain places like the
Combobox, we can't distinguish between afocusand afocus-visiblebecause the interactions don't involve "actual" focus (the actual focus remains on the combobox input field). So basically we need a single highlight style that meets contrast requirements.Plus, I noticed that the "hint text" often used in these item popups won't have enough contrast against the lighter highlight color.
I vaguely remember I worked with @fcoveram where we decided to go with the lighter highlight color. Maybe it was because we were considering putting full checkbox indicators (instead of just checkmarks) in certain items at the time, and a stronger highlight color would collide with the checkbox color when checked. We since dropped this idea, so maybe we can go back to a solid highlight? Not sure I'm remembering correctly.
Just in terms of simplicity though, a border instead of a background color is probably the simplest because we don't have to think about color contrast for the content.
ciampo commentedon Jul 28, 2026
I'd be in favour of returning to stronger solid focus / hover styles, especially since it's in continuity with that we're already doing in the
@wordpress/componentspackage. It still leaves the doots open for future changes, if necessary3 remaining items
fcoveram commentedon Jul 31, 2026
I just realized that the example I explained above is exactly what Github does.
CleanShot.2026-07-31.at.13.09.23.mp4
mirka commentedon Aug 8, 2026
Something like @fcoveram's approach might work. Let me figure out the technical feasibility for some of the components, and I will report back.
ciampo commentedon Aug 10, 2026
For completeness, I wanted to note that GitHub does, in fact, use different focus styles for "keyboard focus" vs "virtual focus", especially in scenarios when both are used (ie. comobox filtering a list, similarly to what was flagged earlier by @mirka ):
I'm not saying that we have to do the same, but I wanted to point out that the example app we've been looking at actually handles virtual focus differently from keyboard focus.
(Also, separatley, note how the dialog trigger (ie the "Type" button) stays highlighted while the dialog is open)
fcoveram commentedon Aug 11, 2026
For comobox filtering a list, I initially thought of two focus rings, but that derails the focus purpose and sets two elements at the same level. A hierarchical code would be better, so for that I'm thinking of the following:
Keeping the focus ring in the input sets the focus in just one control, so maybe the suggestion above works better for conveying that both interactions (move between options and type) work side by side.
I may be contradicting technical feasibility and not meeting accessibility requirements, so please take this suggestion lightly.
oandregal commentedon Aug 18, 2026
re-sharing a comment from here:
While testing the new Menu in DataViews I've noticed a style change: selected items no longer have the focus ring. I welcome this change and should help clarifying what parts of the library have menu semantics (navigate via arrows) and what others have dialog semantics (navigate via TAB), which was not clear before.
For awareness, there's one component that still has menu semantics but uses the focus ring — list layout: navigating across items. We need selected items to be visually selected and we also need the current item to be visually distinct, so we landed on this back in the days:
ciampo commentedon Sep 5, 2026
While working on #82294, I also realized that the combination of neutral text over brand background is not guaranteed to always produce accessible combinations
Two better alternatives would be:
fcoveram commentedon Sep 8, 2026
Does this option include having the focus ring "separately"? Like in this example, list layout: navigating across items
ciampo commentedon Sep 10, 2026
I guess that would be a third option, ie keeping the text/background colors unchanged + showing a focus ring. Although we'd still need to change text/background on hover
ciampo commentedon Sep 11, 2026
Another aspect to keep in mind is that there parts of the UI (list view, autocomplete) where we use background/fg color to indicate "selection" whlie we still use the ring to indicate "focus"
fcoveram commentedon Sep 14, 2026
From the example above, the version in ListView looks slightly overloaded with the extra white ring. Don't have all the context of this change, but the version I see in 7.1 looks cleaner, IMO
ciampo commentedon Sep 14, 2026
Work happened in #82129 , the context was mostly for better focus ring visibility, especially in situations where the focused item was just before / after the selection:
Adding an outer white ring fixed it.
mirka commentedon Oct 21, 2026
Following the implementation findings from #84087, I did another design exploration to land on a new proposed design.
👉 See the full exploration
If this is still too attention-grabbing for the general case, then I think we may need to lean into the custom logic approach, maybe even request better upstream support.
ciampo commentedon Oct 21, 2026
Thank you, @mirka , I love the exploration!
I'm personally leaning on the side of keeping things simple and quiet, and therefore I'm wondering if we could basically do as shadcn/ui does:
but with a darker (ie. accessible) shade of gray, similar to the one used by Spectrum:
It's the simplest, would require little code to implement compared to other solutions, and we can always refine and get more complex if needed.
mirka commentedon Oct 21, 2026
Are you suggesting to use the Spectrum-ish background gray color for both the hover and keyboard states? Then that doesn't really solve our contrast problem. The Spectrum gray is paired with a prominent blue focus ring for keyboard states to keep it accessible. For a background gray to be accessible (3:1) "on its own", it needs to be around
#949494or darker.fcoveram commentedon Oct 22, 2026
Thanks @mirka for the thorough explanation. Very clear.
As I look at the options, I keep interacting with the Editor to see how it would feel there, and the "Keyboard-only ring" version (option F) is the one that feels more consistent with the rest of the UI. The following flow is key to me so the decision is contextualized.
CleanShot.2026-10-22.at.11.14.32.mp4
Although I see an inconsistency between the examples in F section and the one from Fluent. The latter doesn't have a fill.
In aiming for consistency, the ring with 1.5px thickness and the brand tone is better than the one from Fluent. And regarding the offset alignment, it doesn't bother me given that the interaction moves styles the interactive elements and the eye focuses attention on where the highlight is moving to.