-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat(toggle-button): new component #2061
Conversation
I had doubts about the benefits of having the buttons in a WITH UL
WITHOUT UL
|
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.
Regarding semantics of using UL LI or not, when there is a button group there needs to be some level of defining a group. It can be either
-
Using ul li as shown in mind patterns (gives list) (or)
-
Assuming you are using
role=group
andaria-labelledby
attribute to achieve that<div role="group" aria-labelledby="toggle-button-group-label"> <span id="toggle-button-group-label">Toggle Button Group</span> <button type="button" class="toggle-button" aria-pressed="true">Image Button Title 1</button> <button type="button" class="toggle-button">Image Button Title 2</button> <button type="button" class="toggle-button">Image Button Title 3</button> </div>
IMO, both of these approaches are fine. The choice between them depends on the desired level of semantic markup and flexibility in styling.
I had doubts about the benefits of having the buttons in a
<ul>
(deviation from the current draft of MIND patterns). From a screen reader perspective, there was a single spoken "list" between the two versions:
1st rule of ARIA is don't use ARIA ;-)
|
Lets leave this for 16.3. That way we can have this as the first change and then also get a component out in the same release. |
@saiponnada , @ianmcburnie , just to clarify, the Originally, I believe we discussed having For now, this is what it would look like: <div class="toggle-button-group">
<ul aria-label="List of Shipping Options">
<li>
<button type="button" aria-pressed="false">
IMAGE
UPS Ground
PRICE
</button>
<li>
<button type="button" aria-pressed="false">
IMAGE
USPS Priority
PRICE
</button>
<li>
<button type="button" aria-pressed="true">
IMAGE
Fedex Ground
PRICE
</button>
</li>
</ul>
</div> Would that work? I added the label on the |
I guess that should work. By default UL LI tag is interpreted as List. So in the aria label, just Shopping options is enough. Sometimes if we use a heading e.g, Shopping options, then this would be unnecessary. It depends on the context around. So when we develop this in ebay UI label might be empty. |
Sounds good! Yea, I was a bit concerned over the redundancy. I do think that the Something like, "Single-selection group of shipping options" (single-select) and "Multi-selection group of size options" (multi-select). |
I was imagining the context for the button group would be provided by either: a) a preceding onscreen heading element (e.g. "Shipping Options") Option a) would always be preffered for most clarity. The trouble with aria-label on the list or container is that it creates a different experience for AT. Better if we can to have same experience for all users. |
I see. In the scenario without the heading though, would the context really be clear from the buttons themselves? One of the minimal layout themes simply has numbers -shoe sizes. Would we just prescribe/require a heading in those cases? I'm fine either way; we just have to cover all the use-cases and be more prescriptive in some circumstances. That said, I'm not sure if there will be anything applicable to this PR. Should we continue this discussion in the following PR where this structure is going to be implemented ( |
Preference for app teams would be this order:
We could document this on Skin, and rather than having all 3 examples shown on Skin we could just go with the minimal version (option 3, ARIA) for the purposes of keeping examples concise (we do this with radio button and checkbox modules). |
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.
Looks great! Just a few comments and points for consideration.
It feels like the List View variations section repeats the example that was in the first toggle button section. Following on from my previous comment, I wonder if we could just merge these two sections and show all list view variations in sequence, one at a time, followed by all gallery view variations? ![]() ![]() |
@ianmcburnie , done. |
3a09804
to
4ca7368
Compare
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.
Looks great! Just one small docs change and then I think this should be good to merge
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.
Just a few docs change suggestions. If you like them, they can be committed directly here in the GitHub UI.
Co-authored-by: Ian McBurnie <[email protected]>
Co-authored-by: Ian McBurnie <[email protected]>
Co-authored-by: Ian McBurnie <[email protected]>
Co-authored-by: Ian McBurnie <[email protected]>
Co-authored-by: Ian McBurnie <[email protected]>
* feat(toggle-button): new component
Fixes #1970
Description
This introduces the
Toggle Button
component which is a subset of a future component,Toggle Button Group
(responsive layouts using a set of Toggle Buttons).Notes
Screenshots
Checklist