-
Notifications
You must be signed in to change notification settings - Fork 125
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-checked on option and treeitem #1052
Comments
yeh. seems to me i'm less familiar with Interested if there's something I'm missing here though? |
Hi, aria-checked is supported on the option and treeitem roles to support tri-state checkability using the "mixed" value, which doesn't exist using aria-selected. There are indeed cases where this is necessary, and it does map to equivalent roles within the accessibility APIs for both of these roles. |
I've run into the tri-state use case before, but I don't think that's a good reason to support both If they're both supported on the same element, it seems to me that they would need to mean different things, and be able to be individually added to the option or treeitem independent of each other. If we go that route, there should probably be some definition of what it means if an option or tree item is selected but not checked, and vice versa. |
agree with Sarah here. it's confusing that both are allowed, and anecdotally can say it's resulted in some issues I've seen where developers have argued they needed both. I can think of situations where this might be necessary for tree items, so again, don't have as much of an opinion there. But less so for options where a more straight forward pattern of checkboxes / a single tri-state checkbox to indicate a mixed state wouldn't have been preferable. But, I'm interested in learning about patterns that would require a deviation. |
|
You can't remove aria-checked from option without breaking current implementations like the following one. In this case, after typing a string like "hum" then pressing the down arrow to enter the listbox, the spacebar is required to toggle checkability. Implementing this using aria-selected doesn't work, I've tried this. Option checkability is also used to indicate when all controls in a subsequent section are checked or selected, set to "true" if all are, "false" if none are, or "mixed" is some of them are. Whe have enterprise clients using this within complex UIs right now. If you pull this out, it will break all of these. |
In general I think it makes sense to prioritize creating a clear and logical spec in the long term over maintaining support for all existing implementations, but in order to be considerate to existing implementations we could add a Specifically regarding the use case you linked to: I'm not sure I understand why that's an argument for I put together a quick example with The mixed selection state does seem compelling to me for tree items, but I still think we shouldn't allow both attributes to coexist. If we do find a compelling reason to support both, we likely would need to define how both would map if they were independently defined on the same node. |
yeh, can confirm the double state announcement quirk with Firefox+JAWS, as well as no selected items announced, regardless of how many are checked, with VO+Safari with the whatsock example. Sarah largely summed up everything else I'd want to say here. Regarding noting something as deprecated, seems there's precedent. |
@accdc: For the example http://whatsock.com/tsg/Coding%20Arena/ARIA%20Comboboxes/ARIA%20Comboboxes%20(Native%20Inputs,%20Multiselect%20Editable%20with%20Substring%20Match)/demo.htm your explanation that aria-checked must be used because of the mixed status does not apply. Therefore I would also say that aria-checked should not be applicable at least for option, but possibly for treeitem |
In general, we try to avoid putting limitations into the ARIA spec unless they are necessary. This is because we cannot anticipate every possible use case. There are definitely use cases for both listbox and tree where checked is a more appropriate semantic than selected and vice versa. Ruling out either semantic is not really a necessary limitation. I think there might be a potential argument for not allowing both at the same time in the same widget. However, is that something that should be warned against or prohibitted? Is it really the case that there is not a scenario where both could be useful? Imagine a scenario where the checked state represents a persistent state that gets stored. And, in the same list or tree, there may be operations that can be performed on the items, e.g., remove, move higher in the list, etc. The selected state could represent selection for operation while the checked state represents the persistent state of the item. Maybe the instructions say check all items that you want stored offline. Additionally, you could manipulate the order of items. So, you could use standard selection keys to select one or more items for an operation like move up. I am not convinced that putting a prohibition in the ARIA spec is appropriate in this case. Perhaps a middle ground approach is to consider an "authors "MAY" statement that says they "May" use both but "SHOULD" be careful to ensure users are able to discern the meaning of each state. We can also add clarifying information to the guidance for aria-checked and aria-selected in the APG. |
In HTML Please don't take this as an argument to me not understanding there being a potential use case to indicate that some / all / none of the options within a listbox have been selected. I just question if this is the way to do it, again noting that even the provided example doesn't expose this information consistently. That said, if such allowances for both states continue then I would fully agree with your mentioning of a middle round, as I do think the specification should document why this diverges from HTML, and guidance of when both states would be appropriate could then make it's way into APG. |
Hi, This is true in UIA as well, and can be seen every time you open My Documents. If you look at the accessibility tree properties for every item listed there, you will se a checkable state option on each option listed. |
@accdc it's an interesting example, but I'm not sure WinForms is the best framework to use as a blueprint going forward. Here's the same control in UWP, where you can see selection is handled with the Regarding Matt's suggestion that we continue allowing both checked and selected: I'm still concerned about allowing both I've actually run into real-world use cases where tree items were both selectable and supported actions like move, delete, edit, etc., but none of those were implemented using dual checked/selected states. I don't think that's a good use case for needing both properties supported at once, since more usable implementations already exist. I feel like maybe I could use some clarification on what would make a limitation necessary vs. not necessary. From my perspective, the risk of developer confusion and misuse combined with a lack of practical support are a compelling reason to limit this in spec, though I'm not sure how that matches up to a bar of necessary. Should we also be applying that bar to revisiting whether e.g. prohibiting dual checked/selected states on |
Part of the problem seems to be that both attributes can be used without constraint. Enabling something to be simultaneously selected and unchecked (or vice versa) seems like something we should avoid. Unless we can find a reasonable number of production examples in the wild, where there is a clear case for needing both attributes simultaneously, I suggest we make it a clear requirement that only one of these attributes can be used at a time. |
Just as a bit of a reality check, this is code I ran across today in a popular third-party UI framework that makes grand claims about accessibility (ids, classes, and text modified or removed so as to not call anyone out):
Obviously they haven't implemented the treeitem well, and on some level we can't control that. On the other hand, this is actually a pretty tame misuse of ARIA compared to what I come across daily. When I'm able to ask the original developer why those choices were made, it's often "I saw this was supported in the ARIA spec" or "I saw this in the APG." I know it's not our job to prevent developers from abusing ARIA or using APG examples without testing support, but I would really love to see the spec move to where a developer who has no specialist knowledge or context making a good-faith effort can take it at face value and end up with something reasonably accessible. In this specific case, I think adding a requirement that |
Here is a real-world case in Tableau where we have a listbox with options that are both checkable and selectable, just as you've described:
In this case, three of the five options are checked, which indicates the user wishes to filter on those three years. Two of the options are selected, which allows a user (via either mouse or keyboard) to batch-toggle a large number of items. To answer @smhigley's question about how the toggling works in this particular control -- selection follows focus, with SHIFT modifier expanding a contiguous range. Ctrl-click is supported for creating non-continguous selection ranges, which is unfortunately not available for keyboard users but follows the legacy behavior of this control in our pre-web product. SPACE toggles the checked state of any/all selected items. For a mouse user, clicking the check box toggles checked state, while clicking the label text changes the selection state. Not saying this is perfect, but I present it as an "in the wild" example of a listbox that uses both properties. If there is another pattern that would be better for representing this, I'm happy to hear about it -- I will be the first to admit that it's weird to have a multi-select listbox whose "really actually selected items" are |
Speaking of "in the wild" examples, here's a couple more: https://a11y-guidelines.orange.com/web_EN/exemples/check-listbox/index.html https://www.lightningdesignsystem.com/components/combobox/#Listbox-markup |
This is very common in Business UIs (Material selection scenarios etc,) |
Both the linked examples (Orange and Lightning) seem to be mixing up @craigkovatch for your example, I am very interested in what keys a user would press if they were on e.g. the checked-but-not-selected "2016" option in your example if they wanted to a) uncheck, or b) select that option. I'm also interested in how you communicate that separate keyboard interaction for checked vs. selected to the user, and also how you communicate the different in-app meanings of checked vs. selected. I don't even think this works visually -- as a sighted mouse user, if I'm able to separately check and select by e.g. clicking on the checkbox vs. the option name, I would have no idea which one I need to do in order to accomplish any given task. And then there's the added problem of awful pointer target sizes with a checkbox nested within a larger option hit target, and the problems go on... I really think having multiple on/off states on any one item like this fails along multiple axes, and shouldn't be supported in the spec. |
I understand what you're getting at, and |
I've been trying to think of an example that would use both Please note that:
Imagine a To Do list.
Another example (same interaction, different use case) might be a list of breakpoints, where "checked" means "enabled". In these thought experiments,
I'm not saying this is necessarily a good design. The app would want to make it clear, either through documentation, labelling or describing, that "checked === done" and "selected === ready for action". Space key requires extra design thinking because if the user selects some checked and some unchecked items and hits space, then what? Error message? Toggle anyhow? Always check? Do nothing? I'll let the design team decide what makes sense for the app. :) |
@jscholes wrote:
James, That input in the side bar shouldn't be a combobox because when you choose an item from the list it is not setting the value of the input. A combobox is an input that has a popup that helps set the value of the input. Choosing items in the popup should close the popup and put that value into the input. The edit field that appears with the label chooser in GitHub is simply a filter. It filters what appears in the list of tags. That list is basically a multi-select listbox where selection means that tag has been applied to the issue. Since the tags chooser widget is a multi-select, selection should not follow focus. Instead, the user moves focus to a tag and should then press space to toggle the selected state. In that implementation, it is also perfectly valid to use aria-checked instead of aria-selected to represent the state of the tag. There is no need for both. Personally, in multi-selects like that, I prefer aria-checked. For some reason it seems more clear to me. But, I probably only have that bias because of my background. I would strongly suggest using aria-checked if the state is visually represented with a check mark. I believe the most appropriate ARIA patterns for the GitHub label chooser are a disclosure button that shows/hides the filter textbox and a multi-select listbox. Three very simple patterns that are all well-supported -- nothing tricky. At this time, it is using a menubutton and a menu ... and it does not work well. That combination could possibly work without the filter. But, ARIA does not support textboxes inside of menus. |
Agreed on these semantics. But they would still need to use
We also agree on this. But I don't believe the support for For example, with NVDA/Chrome, a checked state is announced but not an unchecked one, meaning that users have no idea they can toggle the current item. On MacOS with VoiceOver, neither checked nor not checked are announced. So while the pattern may be valid, it would be irresponsible to actually suggest that anybody implement it. Again, I'm mindful of the title of this issue,
(where "it" refers to |
That sounds like some bugs need to be filed on screen readers, then 🙂 |
I agree. But the aim of this thread seems to be to make a determination about whether To be clear, I have an interest in @smhigley What are your thoughts? In the first post of this thread, you wrote:
But in response to my GitHub sidebar example, you wrote:
These two don't necessarily work together, if you're proposing that |
For use during the call today, I put together a working example of each of the patterns we've been discussing: https://quirky-meitner-4a68e8.netlify.app/. I added an @jscholes I know the original proposal was to disallow |
I mouse clicked the first checkbox, then after clearing the JS alert, shift+clicked the fifth, resulting in this: I'm not sure why there is a both a multi-selection state and a multi-checked state. What does this UI mean: to have multiple selections here that are different from the multiple checked states? |
@smhigley Thanks for clarifying your position and the samples. Will this URL remain active so that it can be used in AT/browser bug reports if necessary? Or can it be forked? Everyone will have a different dog in this fight based on what they need to support, or would like/participate needing to support in the future. I've made it clear that my priority is consistent support for Having said that, it is my strong opinion that web authors should not be constrained based on what the ARIA Working Group believes to be a usable or pertinent pattern. We've all been around the block enough times to know that if a web or native control doesn't provide exactly what a web author or other stakeholder feels is required, somebody will invent their own. ARIA exists to ensure that, good or bad ideas aside, users of assistive technologies can at least be supported or taken into account. If the users of that pattern find it to be frustrating, inappropriate or even blocking, it is for them to raise that with their employer or other applicable entity, and not for the ARIA Working Group to dictate what should be done. That's my understanding, anyway; happy to be corrected! Anecdotally, I would happily implement a dual-state list box or tree view if I could guarantee accessibility or the availability of training for the target audience, particularly if one of those states was a convenience factor and not strictly necessary to complete a task. For instance, inside an accessibility test reporting tool, I may want to claim that an issue fails multiple contiguous criteria. The checked state would determine whether a given criterion was applicable, but it would also be helpful to be able to press Shift+Down Arrow a few times and check all of the selected criteria in one go. Necessary? No. But certainly helpful. I understand that there are concerns with a UI like the one outlined above. It may be extremely difficult to make accessible for speech recognition users, and surfacing the dual state visually without relying on colour alone may be a challenge. But real-world constraints mean that somebody may implement such an UX regardless, and we shouldn't deny support for their endeavours purely from an ARIA perspective. When we work with them on a voluntary or professional basis as accessibility practitioners, or provide them with feedback as customers, that's when fundamental design concerns can be raised. |
There was a question why we have selected AND checked states for treeitems. I remember having "checked" on treeitem to reflect mixed states like for example in MS software installation trees like below: [*] All
You can't map that properly with selected state. And selected was in because every tree item is selected implicitly when focused as list definition says. |
@stes-acc I think GitHub's Markdown renderer interfered with what you were trying to convey there, but an installer is certainly a great example of where
If this is also the case for items with no |
@jscholes wrote:
If aria-checked is used to indicate the opt in/out state in the installer, why would selection follow focus? Why should there be a selected state at all? |
I agree that there shouldn't need to be. My comments were specifically in line with those over at the related issue (#1311) where it was pointed out that there is currently confusion about when |
Also note: the verbosity of NVDA was explicitly observed for treeitems with
In other words, if NVDA announces "not selected" for every treeitem with no |
@jscholes wrote:
I'll probably be experimenting a bit with that URL, so it's not the best to use to file bugs. If you want, the source code is here: https://github.com/smhigley/aria-mocks. You don't really need a working example like this to file bug reports, though; just some static HTML with the roles/attributes should be plenty. The issue here is still the conflict between checked and selected. Asking authors to always set selected to the currently focused item is not a good spec solution as @mcking65 mentioned, since selection is conceptually not the same thing as focus. You're also not consistently reducing verbosity by setting it, since multiple screen readers will read the selected state in addition to not selected. VoiceOver will even only read "selected" but not "not selected," so there isn't really even a good practical workaround there. re the ARIA spec adding constraints to authors: there are plenty of constraints already in the spec. Most of the characteristics table directly deals with adding constraints; |
Removes "selectable" from the definition of option to support cases where either an item is checkable instead of selectable or an item is neither selectable nor checkable (i.e., similar to disabled). The definition of option is then: >An item in a listbox. Replaces the statement: >Elements with the role option have an implicit aria-selected value of false. with a list of conditions that must be met before a user agent can provide an implicit value for aria-selected. This enables authors to: 1. Use aria-checked instead of aria-selected in any listbox. 2. Indicate that an option is not selectable or checkable by omitting the declaration of checked or selected in a listbox where either checked or selected is explicitly declared on some of the options. Adds authoring guidance that: 1. Weakly suggests use of checked instead of selected in multi-selects. 2. Strongly discourages use of both checked and selected in the same listbox. In the characteristics table for option: 1. Removes aria-selected from required properties and adds to supported properties. 2. Removes the implicit value for aria-selected.
@smhigley, @aleventhal, and I have been meeting offline to work on proposals that we hope will lead to consensus. I have started to draft some language in PR #1340. Keep in mind, this is draft that is inspired by on-going conversation; it does not represent conclusions from that conversation. In the spirit of looking for middle ground that avoids placing constraints on authors that might not be essential, here is draft authoring guidance for the option role that is included in the pull request.
I include a bit more color on the rationale as well as explanation of other changes in my comment in #1340. |
I think there may be an assumption underneath some comments in this thread that I'd like to bring to the surface in the hope that clarity about assumptions can help inspire understanding of differing perspectives. I think the gist of the assumption is something like the following.
I think the spirit of the assumption is good. But, I'm hesitant to endorse the ARIA specification as a tool for limiting authors abilities to serve a specific audience with a specific solution or even to enforce good design principles. To use a building construction analogy, I've thought of the scope of ARIA to be most comparable to the specifications for building materials, e.g., it specifies the dimensions and load baring capacity of a specific truss. ARIA does not tell you how far apart you should space your trusses in a specific circumstance. For that, we turn to the building code -- WCAG. It is also important to recognize the limits of WCAG. If you were to design a home using a building code as your definition of good design, it would be unsurprising if the home were unliveable. For instance, you might find the toilet positioned between the kitchen stove and sink, and from what I know about private residential codes, most would permit it as long as spacing requirements are met. |
I just want to express sincere gratitude to @smhigley, @mcking65, and @aleventhal for your work on this RE the above that Matt posted as a working summary. Also Matt, thank you for the clarification around purpose as that matches my original understanding of the ARIA specification. |
@mcking65 really appreciate the effort, commentary, and summaries here. Thank you and everyone else who contributed. Would like to ask a clarifying question via scenario: say I have a combobox, with a multi-select listbox popup. DOM focus of course remains in the This is a scenario in which I would expect to use (Looks like this is exactly what SalesForce does in Lightning comboboxes, FWIW: https://www.lightningdesignsystem.com/components/combobox/#Multiple-selections) |
@craigkovatch wrote:
This would be a VoiceOver bug. If it is still present, we'll catch it in the aria-at project. However, this bug would only negatively impact a free-standing listbox. If a listbox is a combobox popup, selection follows focus so that bug would be inconsequential.
As of ARIA 1.2, combobox is a single-select widget. The value of the combobox is one item chosen from the popup. If a future version of combobox were to support choosing multiple items for the value of the combobox, you would still only use either checked or selected, not both. The VoiceOver bug would have to be fixed if VoiceOver were to support a multi-select combobox.
The constraints in the PR would definitely permit a future version of combobox that supports multi-select. But, again, as described in the PR, you would use only checked or selected, not both. As of today, it is not a useful test case because of current combobox constraints. |
Reviewing https://www.w3.org/TR/wai-aria-1.2/#combobox, I don't see anything that speaks to this. Is this not yet reflected in the current Working Draft? |
I also think that the ARIA specification for combobox does not currently prohibit multiple selection. In the APG it becomes clearer that only one value can be selected. I.e. the specification should say here more clearly that multiple selection is not allowed. In the future, multiple selection should be possible with combobox and I am in favor of implementing this as soon as possible. Many frameworks have been offering comboboxes with multiple selection for a long time now, but they all don't work well because the corresponding ARIA support is missing |
Removes "selectable" from the definition of option to support cases where either an item is checkable instead of selectable or an item is neither selectable nor checkable (i.e., similar to disabled). The definition of option is then: >An item in a listbox. Replaces the statement: >Elements with the role option have an implicit aria-selected value of false. with a list of conditions that must be met before a user agent can provide an implicit value for aria-selected. This enables authors to: 1. Use aria-checked instead of aria-selected in any listbox. 2. Indicate that an option is not selectable or checkable by omitting the declaration of checked or selected in a listbox where either checked or selected is explicitly declared on some of the options. Adds authoring guidance that: 1. Weakly suggests use of checked instead of selected in multi-selects. 2. Strongly discourages use of both checked and selected in the same listbox. In the characteristics table for option: 1. Removes aria-selected from required properties and adds to supported properties. 2. Removes the implicit value for aria-selected.
Removes "selectable" from the definition of option to support cases where either an item is checkable instead of selectable or an item is neither selectable nor checkable (i.e., similar to disabled). The definition of option is then: >An item in a listbox. Replaces the statement: >Elements with the role option have an implicit aria-selected value of false. with a list of conditions that must be met before a user agent can provide an implicit value for aria-selected. This enables authors to: 1. Use aria-checked instead of aria-selected in any listbox. 2. Indicate that an option is not selectable or checkable by omitting the declaration of checked or selected in a listbox where either checked or selected is explicitly declared on some of the options. Adds authoring guidance that: 1. Weakly suggests use of checked instead of selected in multi-selects. 2. Strongly discourages use of both checked and selected in the same listbox. In the characteristics table for option: 1. Removes aria-selected from required properties and adds to supported properties. 2. Removes the implicit value for aria-selected.
* Resolves #700 and resolves #1052 with the following changes. Removes "selectable" from the definition of option to support cases where either an item is checkable instead of selectable or an item is neither selectable nor checkable (i.e., similar to disabled). The definition of option is then: >An item in a listbox. Replaces the statement: >Elements with the role option have an implicit aria-selected value of false. with a list of conditions that must be met before a user agent can provide an implicit value for aria-selected. This enables authors to: 1. Use aria-checked instead of aria-selected in any listbox. 2. Indicate that an option is not selectable or checkable by omitting the declaration of checked or selected in a listbox where either checked or selected is explicitly declared on some of the options. Adds authoring guidance that: 1. Weakly suggests use of checked instead of selected in multi-selects. 2. Strongly discourages use of both checked and selected in the same listbox. In the characteristics table for option: 1. Removes aria-selected from required properties and adds to supported properties. 2. Removes the implicit value for aria-selected. Co-authored-by: Carolyn MacLeod <[email protected]> Co-authored-by: James Teh <[email protected]> * Duplicate option revisions in treeitem
The option role includes
aria-checked
in supported states and properties, which inherits into treeitem.Since
aria-selected
exists on both and already indicates selected state, it's unclear what additional meaningaria-checked
could convey. E.g. is there a use case for either of these currently valid option states?:If not, I believe it should be removed from
option
(andtreeitem
). I've already run across the above markup (odd as it seems) in a product. It resulted from some confusion reading the ARIA spec and thinkingaria-selected
indicated current focus andaria-checked
indicated selection, so updating to a more strict set of allowed attributes seems beneficial.The text was updated successfully, but these errors were encountered: