New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Components]: Rename SegmentedControl to ToggleGroupControl #34111
[Components]: Rename SegmentedControl to ToggleGroupControl #34111
Conversation
Size Change: -43 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this renaming makes sense.
@mtias mentioned his doubts about the Control
suffix. While it's a legitimate thing, I wonder if we should stick to it for consistency reasons with components we can't rename.
After checking the other component names here: https://developer.wordpress.org/block-editor/reference-guides/components/, I thought it was better to keep the suffix for consistency, so I agree with Riad. I have no strong opinions though, and can be changed if needed.. |
If we'd like to be moving to a different place regarding naming I don't think current consistency should be the deciding factor. It'd be best to avoid a subsequent rename. Curious what @diegohaz thinks as it's an important part of making the component set approachable. |
Regarding the Regarding I see 2 patterns with which this component design could be implemented: radio group or tab list. We're currently using the radio group here, which makes more sense for the use cases we have. But I can see how this component design could be used to control the visibility of sections, in which case the tab list would make more sense. But I don't think the toggle button pattern applies here. For example, in the image below we have a group of toggle buttons (format) and a radio group (alignment). Screenshot from https://www.w3.org/TR/wai-aria-practices-1.2/examples/toolbar/toolbar.html The main difference is that the toggle button group may have more than one selected (technically, The markup is also quite different: <!-- toggle button group (simplified) -->
<div>
<button type="button" aria-pressed="true"></button>
<button type="button" aria-pressed="true"></button>
<button type="button" aria-pressed="false"></button>
</div>
<!-- radio group (simplified) -->
<div role="radiogroup">
<div role="radio" aria-checked="false" tabindex="-1"></div>
<div role="radio" aria-checked="true" tabindex="0"></div>
<div role="radio" aria-checked="false" tabindex="-1"></div>
</div> On the other hand, I guess "toggle group" doesn't necessarily mean "a group of toggle buttons", and I can find a lot of examples on the internet where "toggle group" is just another name for "radio group". I also understand that, since we're not only dealing with semantics, but also with layout, So, I'm not opposed to |
Description
Follow up of: #34017 (comment)
In this PR
SegmentedControl
is renamed toToggleGroupControl
. The internalRadioGroup
used is fromReakit
so it needs more investigation if it can be removed with the currentRadioGroup
fromwordpress/components
- this is subject to change name as well toToggleGroup
and not be exposed in a follow up PR probably..Testing instructions
PostFeaturedImage
when aheight
value is set. So this should work as expected