Skip to content

Update ToggleGroupControl design #64439

Closed

Description

@jameskoster

When multiple instances of this component appear in quick succession the heavy active state add's a lot of noise and can be overwhelming. Let's explore ways to remedy this in an updated design.

Activity

  1. converted this from a draft issue on Aug 12, 2024
  2. jameskoster commented on Aug 12, 2024

    @jameskoster
    ContributorAuthor

    One potential solution is to outline the active state and apply a gray background to the overall control:

  3. added
    Needs Design Feedback
    on Aug 12, 2024
  4. mirka commented on Aug 13, 2024

    @mirka
    Member

    Fully understanding that this is a difficult design exercise, I'll write down some requirements that ToggleGroupControl has in terms of component states:

    • A (focusable) disabled state for the entire component (currently not implemented at all)
    • A (focusable) disabled state for a single option item (disabled state is implemented, but not focusable disabled)
    • A "de-selectable" variant. This pattern can be seen in Typography controls such as letter case and text decoration.

    I guess it's not off the table that we diverge the "standard" ToggleGroupControl from the "de-selectable" which is more like a button group. However, for overall consistency of look & feel, it may make sense to keep the selected item style in line with how we style aria-pressed buttons. Meaning, if we change the selected item style here, we might also want to consider changing it for pressed buttons.

    Pressed toggle button in FontSizePicker
  5. jameskoster commented on Aug 13, 2024

    @jameskoster
    ContributorAuthor

    I guess it's not off the table that we diverge the "standard" ToggleGroupControl from the "de-selectable" which is more like a button group.

    I think that's a good point to discuss. The de-selectable variant is similar to a button group as you pointed out, but also a toolbar. There might be some consolidation to do there.

    For me, the base ToggleGroupControl feels different. Semantically it's more like a radio group whereas toolbars/button groups are more flexible in nature, so a different appearance can perhaps be justified.

    Potential pathways for controls like Letter case include:

    • Use the base ToggleGroupControl but add a 'None' or 'Default' option.
    • Migrate to ButtonGroup, Toolbar, or something else :)

    Here are some mockups for the states you described, plus a couple of others:

    Examples
  6. mirka commented on Aug 13, 2024

    @mirka
    Member

    Great, thank you for integrating all the states. No more blockers from me 👍

    For me, the base ToggleGroupControl feels different. Semantically it's more like a radio group whereas toolbars/button groups are more flexible in nature, so a different appearance can perhaps be justified.

    Yes, I'm not opposed to this at all. The semantics and behavior are different enough that it's arguably better for them to be styled differently.

    Logistically, it would be easiest if we could switch the Letter case and Decoration controls to a standard ToggleGroupControl, and deprecate the isDeselectable variant altogether, since those two are the only use cases in-app.

    I'll note that the Letter case and Decoration controls actually have a "None" option which is deselectable. But the deselectable here shouldn't be strictly necessary, because they're part of a ToolsPanel, which provides the "Reset" functionality. The font size control ToggleGroupControl for example is reset through the ToolsPanel dropdown menu. I think we should be allowed to use the same mechanism for Letter case and Decoration, no?

    Decoration control with deselectable none option
  7. jasmussen commented on Aug 14, 2024

    @jasmussen
    Contributor

    Appreciate the exploration. The main item to solve here is that the dark toggled state can give prominence to the control itself, which in some cases is not desired. This one achieves contrast through the border, though marinating on this, it loses a little bit of the segmented feel, where each option is mutually exclusive to the others. This is a bit more visible in the icon example. There's something to the idea, though, so let's continue to think about how we might thread the needle, perhaps across all the componentry. Maybe it's not possible, that's fine too.

  8. jameskoster commented on Aug 14, 2024

    @jameskoster
    ContributorAuthor

    The main item to solve here is that the dark toggled state can give prominence to the control itself, which in some cases is not desired.

    Is this not solved in the mockups above? There may be other options to try – happy to continue exploring / create more mockups – but I don't know that we should let 'perfect' be a blocker to improvement here.

    Logistically, it would be easiest if we could switch the Letter case and Decoration controls to a standard ToggleGroupControl, and deprecate the isDeselectable variant altogether

    This sounds like a reasonable path forwards to me.

  9. jasmussen commented on Aug 14, 2024

    @jasmussen
    Contributor

    It's solved, yes, but on reflection, one past instinct you shared (maybe in chat) was that this perhaps looked a bit too much like an input after all, making this specific issue not a clear win. I'm also thinking that this can be a low-boil set of explorations that consider not just this toggle, but several of them together, with no rush. What do you think?

  10. jameskoster commented on Aug 15, 2024

    @jameskoster
    ContributorAuthor

    That kind of assumes other controls will be changing significantly which seems unlikely in the short term. So it seems a shame for this one detail to hold up any improvements, especially as it's not 100% clear it is actually an issue.

    I do agree this isn't high priority though.

  11. mirka commented on Sep 13, 2024

    @mirka
    Member

    I noticed this bug #62981 which should be fixed sooner rather than later. We can fix the functionality part without a design change, but ideally we should have a design where a focus ring can be shown on a single option item without it being selected (like a radio group that doesn't have a selected item yet).

  12. jameskoster commented on Sep 16, 2024

    @jameskoster
    ContributorAuthor

    Focussed with no selection could look something like this:

    focussed no selection

    In terms of the individual options, I think they only need focus styles when disabled, right? Otherwise the parent should retain focus?

  13. ciampo commented on Sep 16, 2024

    @ciampo
    Contributor

    In terms of the individual options, I think they only need focus styles when disabled, right? Otherwise the parent should retain focus?

    Imagine having a mix of enabled and disabled option items — wouldn't it be weird if the focus rings moved between the whole group (when an enabled option is focused) and a single option (when it's a disabled option?)

    I wonder if we could keep the design proposed above, and show a focus ring also on "enabled" tabs:

    Screenshot 2024-09-16 at 12 19 00

    We also have a dedicated issue for this specific aspect: #63612

  14. mirka commented on Sep 16, 2024

    @mirka
    Member

    Yes, I think we're going to need to drop idea of the entire control having a focus ring. When there are no options selected and there's only a focus ring on the entire component, there's not enough affordance for the user to understand what the control does. The first option should get the focus ring, much like a radio group or any other Composite-based control.

  15. 2 remaining items

  16. mirka commented on Sep 16, 2024

    @mirka
    Member

    @ciampo I think that makes sense.

    In the past, I felt strongly that there should be a clear visual distinction between the deselectable and non-deselectable variants, thus showing a focus ring on the entire component when non-deselectable. But I no longer think that's possible 😕

  17. jameskoster commented on Sep 17, 2024

    @jameskoster
    ContributorAuthor

    Okay, last question is about disabled states. When all options are disabled can you still focus through each item? Arrow left / right would move focus but not select. Does this mean it's not possible for the component itself to be disabled, only individual options?

    I think this would cover all the states we've discussed:

    Screenshot 2024-09-17 at 13 34 13
  18. ciampo commented on Sep 17, 2024

    @ciampo
    Contributor

    When all options are disabled can you still focus through each item? Arrow left / right would move focus but not select.

    It would be a bit of a weird state, but technically yes — i'd expect each disabled item to be focussable, but not selectable.

    Does this mean it's not possible for the component itself to be disabled, only individual options?

    I would probably also allow for the whole item to be disabled, as a conceptually separate thing.

    I guess that a disabled ToggleGroupControl would still be focussable as a whole, but the user wouldn't be able to focus the individual options — ie. the focus could stay on the whole group, in this case. What do y'all think?

  19. jasmussen commented on Sep 23, 2024

    @jasmussen
    Contributor

    I like this one, but there are some details about it I'd love to tinker with to get it just right. I think it's mainly the gray backdrop that isn't fully gelling quite yet. Perhaps after the beta period we can seek out the way to thread the needle fully?

  20. jameskoster commented on Sep 23, 2024

    @jameskoster
    ContributorAuthor

    Please go ahead and tinker! Here's the Figma.

  21. added
    [Status] In Progress
    on Dec 23, 2024
  22. tyxla commented on Dec 15, 2025

    @tyxla
    Member

    @jasmussen @jameskoster, what do we need to finalize the design here?

  23. jameskoster commented on Dec 15, 2025

    @jameskoster
    ContributorAuthor

    I think we should implement something like the mockup in this comment for now. We can always iterate to refine details. This is a glaring issue that would be nice to fix. If nobody else picks this up I'll see if I can submit a PR this week.

  24. tyxla commented on Dec 15, 2025

    @tyxla
    Member

    Thanks, that would be amazing @jameskoster 🙌 Agreed that it's a bit of a poke in the eye right now.

  25. jasmussen commented on Dec 16, 2025

    @jasmussen
    Contributor

    Let's make this happen. If it happens in the design Jay links to, I'll approve it.

    I did comment previously that I'd tinker with the design, here's what I came up with instead, ligth and dark modes:

    Image Image

    The primary change here is to add the gray backdrop to the active knob, instead of the field background, and to add a 1px border around the whole control. Motivation is that we don't use the gray backdrop as background in other components, whereas we do use the gray border in a few places, such as:

    Image

    In that vein, I expect the bordered version will fit in better with its surroundings. Every other heuristic is the same as what Jay proposed, this is primarily the moving of the backdrop and the addition of a border. But as noted, no blockers for a PR to move forward.

  26. jameskoster commented on Dec 16, 2025

    @jameskoster
    ContributorAuthor

    Nice, I think that design better aligns with the tokens in @wordpress/theme which will make the transition less visible when @wordpress/ui components are adopted in the Editor 👍

  27. tyxla commented on Dec 16, 2025

    @tyxla
    Member

    Nice work @jasmussen and thanks for confirming @jameskoster 🙌

    cc @aduth as we discussed working on this recently.

  28. linked a pull request that will close this issueUpdate ToggleGroupControl visual design #74036on Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Design Feedback[Status] In Progress

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions