Skip to content

Design system: Standardize Tab stop and composite focus indicators #80405

Open

Description

@mirka

What problem does this address?

Currently, UI components across @wordpress/components and @wordpress/ui use several different styles to indicate focus.

Menu focus Dropdown menu focus Select focus Tabs 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).

  • Tab stop focus: --wpds-color-stroke-focus ring
  • Composite focus: --wpds-color-background-interactive-brand-weak-active background

Activity

  1. self-assigned this
    on Jul 17, 2026
  2. added
    [Type] Enhancement
    Design System
    on Jul 17, 2026
  3. added
    Needs Design Feedback
    on Jul 17, 2026
  4. mirka commented on Jul 17, 2026

    @mirka
    MemberAuthor

    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:

    Combobox focuses
  5. jasmussen commented on Jul 20, 2026

    @jasmussen
    Contributor

    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?

  6. mirka commented on Jul 20, 2026

    @mirka
    MemberAuthor

    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.

  7. jasmussen commented on Jul 20, 2026

    @jasmussen
    Contributor

    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.

  8. mirka commented on Jul 28, 2026

    @mirka
    MemberAuthor

    I'm starting to think we may need to revert to this stronger highlight style 🤔

    Menu focus

    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.

  9. ciampo commented on Jul 28, 2026

    @ciampo
    Contributor

    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

  10. 3 remaining items

  11. fcoveram commented on Jul 31, 2026

    @fcoveram
    Contributor

    I just realized that the example I explained above is exactly what Github does.

    CleanShot.2026-07-31.at.13.09.23.mp4
  12. mirka commented on Aug 8, 2026

    @mirka
    MemberAuthor

    Something like @fcoveram's approach might work. Let me figure out the technical feasibility for some of the components, and I will report back.

  13. ciampo commented on Aug 10, 2026

    @ciampo
    Contributor

    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.
    Image

    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)

  14. fcoveram commented on Aug 11, 2026

    @fcoveram
    Contributor

    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.

  15. oandregal commented on Aug 18, 2026

    @oandregal
    Member

    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.

    Before After
    Screenshot 2026-08-18 at 12 38 21 Screenshot 2026-08-18 at 12 38 30

    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:

    Screenshot 2026-08-18 at 13 01 39
  16. ciampo commented on Sep 5, 2026

    @ciampo
    Contributor

    While working on #82294, I also realized that the combination of neutral text over brand background is not guaranteed to always produce accessible combinations

    Image

    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)
    • stronger "branded" style (as suggested here)
  17. fcoveram commented on Sep 8, 2026

    @fcoveram
    Contributor

    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

  18. ciampo commented on Sep 10, 2026

    @ciampo
    Contributor

    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

  19. ciampo commented on Sep 11, 2026

    @ciampo
    Contributor

    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"

    Image Image
  20. fcoveram commented on Sep 14, 2026

    @fcoveram
    Contributor

    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

    Image
  21. ciampo commented on Sep 14, 2026

    @ciampo
    Contributor

    Don't have all the context of this change

    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:

    Image

    Adding an outer white ring fixed it.

  22. mirka commented on Oct 21, 2026

    @mirka
    MemberAuthor

    Following the implementation findings from #84087, I did another design exploration to land on a new proposed design.

    New proposal with lighter hairline indicators

    👉 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.

  23. ciampo commented on Oct 21, 2026

    @ciampo
    Contributor

    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:

    Image

    but with a darker (ie. accessible) shade of gray, similar to the one used by Spectrum:

    Image

    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.

  24. mirka commented on Oct 21, 2026

    @mirka
    MemberAuthor

    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.

    Hover background at #949494
  25. fcoveram commented on Oct 22, 2026

    @fcoveram
    Contributor

    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
    Image Image

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Design SystemNeeds Design Feedback[Type] Enhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions