-
Notifications
You must be signed in to change notification settings - Fork 127
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
Aria-pressed : Spec is unclear about the toggle button #1406
Comments
seems like either a situation where one should be using while i understand the point you're bring up here, the fusionfabric examples specifically seem more like they are just broken in not allowing the buttons to be unpressed. e.g., why would i not be able to unbold something without having to make it italic or underlined? |
I get the design aspect you are bringing up. I am only looking at the accessibility part now. |
In the tink.uk example, radio buttons should be used instead of buttons with aria-pressed. Alternatively, a toogle button, checkbox, or switch should be used whose pressed or checked state is identical to Dark and whose not pressed or not checked state is identical to Light The buttons have two problems:
I think the specification is correct, but toggle buttons must be used correctly |
My opinion is, in this scenario toggle buttons and radio buttons can be used interchangeably. |
why false? sounds exactly like they should both have a "mixed" state. |
I don't see it that way. There are elements that users assume are independently operable, such as.
On the other hand, there are grouped elements where it is clear that the status of the other elements in the group changes when I operate one element, e.g.
|
I can't possibly imagine what a mixed state could be. The word "toggle" to me tells me 2 states. But I am a stupid person who regularly has trouble with app-like interfaces. Still, of course, I haz opinions. I don't feel radio controls are appropriate for expanded/collapsed states of things like an accordion widget. Similarly, I don't use checkboxes for disclosure widgets. A group of aria-pressed buttons do in my mind act very similarly to a set of radio controls (just like car radio buttons, they each can have a pressed state and most of the time only one of the group can have the pressed=true state... but not always). But pressed-buttons' interaction is much better for non-forms in my view (see below).
This makes zero sense to me if you have "toggle" in the list. Toggle controls toggle states and content all the time. A disclosure widget IS a toggle widget. It is toggling the visibility of the related content. A light switch is a toggle switch. The room goes from invisible to visible. In fact, the point about failing 3.2.1 is why I wouldn't use radio controls for this. Radio controls, unlike pressable buttons, cannot differentiate between a focussed state and a selected state. Being a keyboarder, merely moving amongst the radios in a group, or exploring them with a screen reader, is no different from choosing them when developers make changes on the page based on focus (and I'd love to fail some of these with On Focus, however changing some content after a set of controls is apparently not the same as a change in context. Developers don't submit forms anymore, that's too old-fashioned now apparently. It's all JavaScript. Oh well). With pressable buttons, users can safely explore the button's names, or Tab amongst them, without changing anything. Users must make a clear effort to select a button. Also, unlike radios, users can (or should be able to) un-select it.
I mean, I guess this would just mean there are no "all-the-things" controls currently active. I can't possible see aria-current doing anything useful here. Just that, these controls are not currently activated. |
I also see it that way. However, I don't use toggle buttons for this, but buttons with aria-expanded and possibly aria-disabled (see https://www.w3.org/TR/wai-aria-practices-1.2/examples/disclosure/disclosure-faq.html, https://www.w3.org/TR/wai-aria-practices-1.2/examples/accordion/accordion.html)
I see it that way, too. I don't know of any implementation with toggle buttons in mixed state. I also don't know how this should work visually. The screen readers JAWS and NVDA also have problems with this: they output the mixed state of the toggle button as checked and not as pressed, i.e. like a checkbox.
I see it differently: In a toolbar, e.g. for text formatting, I can operate the toogle buttons "Bold" and "Italic" independently. If two buttons in the toolbar depend on each other, another element should be used
That is correct. But as I already wrote, I don't need 2 toggle buttons (one for "on" and another for "off"), but only one toggle button or one switch or one checkbox, whose 2 states represent "on" and "off". |
The reason for using aria-pressed instead of aria-expanded on the "expand all" and "collapse all" buttons is to remove confusion for the screen reader users. Adding a aria-expanded attribute to the controls that have same state name may add confusion to the screen reader users.
To provide the button state without creating confusion, aria-pressed attribute is a better approach here. The controls are contained within a div element with role="group" which does communicate to the AT that they are grouped and interact with one another.
Currently, aria-pressed can have values as follows: |
I do as well; it may be a personal thing but I think of disclosures as usually showing more content in general. A toggle would switch between, say, page settings. The example being used in this ticket has a "red herring": it has buttons called "expand" and "collapse", but in the context of an accordion thingie, I see this as users choosing between mayo or ketchup with their fries; a mostly visual style setting. I'm thinking of a graphical mail "indexer" type page where it seems nice, simple, and useful to have separate Collapse All (only shows mail subject) and Expand All (shows subject, sender, and first sentence or so of the mail) as separate controls, because I'm assuming the users can also expand individual ones they want to see as needed.
I'm sorry but what in hell is a mixed pressed state? It sounds like a dry cleaning setting. (And so I believe THIS is the crux of this ticket, and that this is Siri's question. What the hell is partially pressed? Why don't we have this on Is this like when we were kids in those cars with the radio buttons and we discovered if we sorta half-pressed on the other (non-pressed) radio buttons, the currently-pressed button would pop back up so that they ALL looked un-pressed? That was a pretty cool trick, but the radio was still playing just one station. Siri I think we'd both agree that the typical disclosure widget with an
Oh is "mixed" like when you turn ketchup and mayo into that pink slime by mixing them together?? Is... is that legal in polite company? I dunno, I would just ignore that mixed stuff. If you turn your head sideways after breathing in a good whiff of glue, you can kinda make some sense of a "tri-state checkbox", but I think with pressed buttons it's just looking for trouble. Pretend there are only "true" and "false" pressed states. This is how I am currently surviving the pandemic. |
I think the specific example at the top is a bit of a red herring for the entire discussion; or rather, because it was brought up in the context of Both "Expand all" and "Collapse all" are buttons that perform a single action somewhere else on the page when you activate them. A normal button, not a toggle button or expand/collapse button, should work perfectly well, IMO. Sometimes you can't activate one of the buttons (e.g. you can't expand all accordions if they're all already expanded), and in that case the button can be disabled. I don't think there's any reason that example needs to be more complicated than that. I also don't really think the "expand all" and "collapse all" buttons would be expected to convey the current state of the accordions below them. Either you want to expand them all, or you don't; it doesn't depend on whether they're currently all collapsed or in a mixed collapsed state. Léonie's example is a little more interesting, since the theme toggle actually does need to hold and convey on/off state. On the other hand, a lot of other theme switches are implemented as a switch or checkbox, both of which seem like potentially better fits for binary state controls. |
also, @StommePoes,
I feel tagged 😂 |
Has anyone ever seen a mixed state button in the wild? I can't find the concept in any design system. |
Would be nice to remove it, but apparently a couple of the platforms allow it, and there may have been one use case. If we remove this, we would also need to:
Note that there are no mixed state buttons described in the APG... but that sentence was removed after previous discussions on this topic. ;) |
A year and 3 days later (3 representing the 3 states of a toggle button - i 'definitely' planned this) I've re-reviewed this issue multiple times. I essentially see a few tasks / pathways forward here:
|
My understanding is the difference between a checkbox and button applies to same way to mixed state toggle. Checked is supposed be a YES/NO rather ON/OFF. Checked makes sense for forms, but for actionable items. With that in mind, I'm probably going to redesign my "Switches" to be
I can definitely consider this situation for smart switches. If I have a light that's on, I'd use a switch to show on. Off would be off. As for the room itself, I would also have a toggle that can represent a state that is composed of all lights in it. If all are on, it's on. All off, off. Mixed would be mixed.
I can easily design a mixed state Switch by putting the circle in the middle. It also makes sense for a switch to be a button because it's not a form item. If a user toggles the light on, it should immediately take effect, which is the intended result of a real life button. Edit: Completely forgot about |
we should decide on which of these is the best way forward My vote is (1) |
My vote is (1) |
same - 1. actually just came across some useful instances for a mixed toggle button state in a rich text editor... so, definitely has it's place. |
My vote is (1) |
https://www.w3.org/TR/wai-aria-1.1/#aria-pressed
Currently aria-spec says :
Toggle buttons require a full press-and-release cycle to change their value. Activating it once changes the value to true, and activating it another time changes the value back to false. A value of mixed means that the values of more than one item controlled by the button do not all share the same value. Examples of mixed-state buttons are described in WAI-ARIA Authoring Practices [wai-aria-practices-1.1]. If the attribute is not present, the button is not a toggle button.
There are scenarios where two buttons can be used as toggle button. In these cases it will be useful to add aria-pressed attribute to the buttons.
Examples:
https://tink.uk/
https://design.fusionfabric.cloud/ui-elements/button-toggle
The text was updated successfully, but these errors were encountered: