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
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.
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.
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:
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?
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.
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.
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?
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 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).
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:
We also have a dedicated issue for this specific aspect: #63612
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.
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 😕
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:
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?
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?
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.
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:
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:
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.
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 👍
Activity
jameskoster commentedon Aug 12, 2024
One potential solution is to outline the active state and apply a gray background to the overall control:
mirka commentedon Aug 13, 2024
Fully understanding that this is a difficult design exercise, I'll write down some requirements that ToggleGroupControl has in terms of component states:
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-pressedbuttons. Meaning, if we change the selected item style here, we might also want to consider changing it for pressed buttons.jameskoster commentedon Aug 13, 2024
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
ToggleGroupControlfeels 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:
ToggleGroupControlbut add a 'None' or 'Default' option.ButtonGroup,Toolbar, or something else :)Here are some mockups for the states you described, plus a couple of others:
mirka commentedon Aug 13, 2024
Great, thank you for integrating all the states. No more blockers from me 👍
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
isDeselectablevariant 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?
jasmussen commentedon Aug 14, 2024
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.
jameskoster commentedon Aug 14, 2024
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.
This sounds like a reasonable path forwards to me.
jasmussen commentedon Aug 14, 2024
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?
jameskoster commentedon Aug 15, 2024
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.
mirka commentedon Sep 13, 2024
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).
jameskoster commentedon Sep 16, 2024
Focussed with no selection could look something like this:
In terms of the individual options, I think they only need focus styles when disabled, right? Otherwise the parent should retain focus?
ciampo commentedon Sep 16, 2024
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:
We also have a dedicated issue for this specific aspect: #63612
mirka commentedon Sep 16, 2024
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.
2 remaining items
mirka commentedon Sep 16, 2024
@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 😕
jameskoster commentedon Sep 17, 2024
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:
ciampo commentedon Sep 17, 2024
It would be a bit of a weird state, but technically yes — i'd expect each disabled item to be focussable, but not selectable.
I would probably also allow for the whole item to be disabled, as a conceptually separate thing.
I guess that a disabled
ToggleGroupControlwould 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?jasmussen commentedon Sep 23, 2024
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?
jameskoster commentedon Sep 23, 2024
Please go ahead and tinker! Here's the Figma.
tyxla commentedon Dec 15, 2025
@jasmussen @jameskoster, what do we need to finalize the design here?
jameskoster commentedon Dec 15, 2025
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.
tyxla commentedon Dec 15, 2025
Thanks, that would be amazing @jameskoster 🙌 Agreed that it's a bit of a poke in the eye right now.
jasmussen commentedon Dec 16, 2025
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:
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:
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.
jameskoster commentedon Dec 16, 2025
Nice, I think that design better aligns with the tokens in
@wordpress/themewhich will make the transition less visible when@wordpress/uicomponents are adopted in the Editor 👍tyxla commentedon Dec 16, 2025
Nice work @jasmussen and thanks for confirming @jameskoster 🙌
cc @aduth as we discussed working on this recently.