-
Notifications
You must be signed in to change notification settings - Fork 268
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
RFC: ARIA Attributes #235
Comments
I’m in no way any expert on ARIA, and this has many parts to handle, so these are only my interpretations. I think the tree expand/collapse and checkbox should become hidden for screen readers. Everything needed for a screen reader is available on the Tree node through attributes. Not sure if you need to use aria-hidden on them or if it’s enough to set tabIndex to -1. The tree node and dropdown container also render differently depending on simpleSelect (role='option') or not. To handle partial state, it should output aria-checked instead which has ‘mixed’ as an option. But the simpleSelect should still render aria-selected. Some of the attributes are also not applicable since role="option" does not support some of the hierarchical attributes. We also need to define how actions should be handled or just ignore them for now. |
That makes two of us!
I thought so too but their design pattern examples have it otherwise.
I'm ok either way, with marking them
Yes, absolutely.
Agreed. This is why I didn't put any values in the table, just that
Agreed. I wasn't sure how to cover all these variations in a simple manner with the above table. Feel free to edit the RFC if you feel we can depict all these cases with simplicity.
Actions are largely unknowns but we do know that they are all buttons, so I think we can just follow button's specs for them. |
https://www.w3.org/TR/wai-aria-1.1/#aria-hidden
To me the screen reader navigates to the node by keyboard. They should have all required information as aria-attributes on the node itself. The checkbox and expand/collapse button only becomes redundant in my opinion. They are only there for navigation by mouse/visual aids? |
Still, how should one navigate to them? How do we expose them right and so on. |
Hear ya. I think, for starters, tab should go in this cycle:
If no actions then:
If one has actions but doesn't want to cycle through them, then they can use the arrow keys to go to the next node right away, so I think this should be a good enough experience. |
Do you have any example from w3 where they tab within selections? Haven't encountered any. I think that would be a mayor deviation from what's normally implemented which could be a risk. |
Do you mean actions? I don't see them as part of a selection (the node item). You're only selecting/deselecting node items - actions are something that appears inline but are not part of the node value. |
Nope meant node navigation by tab. Have not encountered any example yet where tab does not leave current control. |
Hmm, yeah that does sound weird. One idea would be to use the toolbar pattern if you think of actions as an inline toolbar. Or else we could do |
This Pill List is the closest I've seen to our tag list as well on w3, not sure if it's applicable: |
That's a great example. I'd say it's totally applicable for our tags. And the Data Grid Example seems to follow the toolbar pattern which seems like a good fit for actions. |
How do you suggest it should be combined with treeview, which I think is the right fit? If any actions, should enter/space instead trigger the toolbar so you can use arrows for navigation between the node and actions? If focusing the node enter now triggers toggle instead? Space could still always toggle selection? |
Closed by mistake. This is perhaps something to have in mind: |
Yes, treeview is the right fit.
What do you mean by "trigger the toolbar"? I imagined navigating node with up/down arrows and once the node has focus, the following should happen:
|
Do you mean checkbox selection or some form of "activation" here of node for action navigation?
That's assigned to expanding/collapsing unfortunately. We would not support actions on nodes with children in that case. It would be odd to have different behavior depending on children or not. That's what I meant with Enter activating another behaviour for the node, e.g. navigating between actions instead. I think the treegrid sample is something which is closer to what you're thinking about. Then arrows becomes navigation only after expanding a node instead of going to first child (which is the suggested behaviour for a treeview) Row does not support aria-checked for partial though but that could be solved on the column level instead I guess. |
Yeah, checkbox/radio selection.
Damn, can't win 😆
Agreed.
I understand it now. Enter feels weird though. What about shift+arrows or alt+arrows for action nav? |
Then we introduce our own bindings instead of relying on the recommended one for the roles we say we implement? The treegrid comes quite naturally I think if you give it a go. First column being the label/selection/toggle and the following actions. No idea how that works with most rows only having one column and a few others different number of columns/actions though. I think we should be inspired by that even if we don't change to the roles. Meaning arrow right (and left reversed) does the following:
Since most actions propably are on leafs the expanding propably never will need to be triggered though. How would one know that the arrows has some additional meaning here? Is it possible to use a different role in the middle of a treeview or append aria-owns, aria-haspopup or similar to hint to the user that there's some additional horizontal options/actions? If it weren't for those actions... One option would be to ignore them for now and implement them in another issue? I think |
We should also think about the need for aria-owns populated with, if any, id array of _children since the tree is in fact rendered flat and the relationship is therefore not clear between the two. |
https://www.w3.org/TR/wai-aria-1.1/#aria-keyshortcuts looks interesting. Could set it dynamically only for focused item Unsure it will work in other browsers than chrome though. Found one issue on github saying apple refused to implement it and one open ticket for mozilla/firefox. So perhaps not a good path but would solve our problems I think. Perhaps it's intended for more fixed focus targets. |
This is similar to what I said earlier - isn't it? I guess I agree with the above approach.
It's kinda defacto behavior in software. Shift/Alt/Ctrl are modifier keys and are used in various software for modifying the behavior of arrow keys. It comes intuitively to try using those modifier keys.
We're doing that one way or the other - as we try to use our best judgments in piecing together all different patterns/practices. 😄 By the way, how did the RFC for ARIA attributes turn into a discussion about keyboard nav? I planned on creating another RFC for that! 😄
It definitely is!
I'd say that's still a good start. With Edge switching to Chromium, I'd say that should cover 3/4 major browsers (Chrome, Safari, Edge). The more I read about ARIA, the more I find how flaky the current state of affairs is. There are no universally implemented standards amongst readers or browsers. Every reader/browser has their interpretations and quirks. And one thing that scares me is that "bad ARIA is worse than no ARIA." I'd say let's do the best we can and note the oddities as we go along. And if you have a real use-case, then we can use feedback from that to hone in our implementation iteratively. |
You skipped the part with expand/collapse, which is the default behaviour with left/right arrow on the role treeitem 😄
Well so may be. But we implement the “defacto” for the role not what usually works in software. Picture yourself blind, the only guidance you have is the how the screen reader interprets the aria attributes and content available. You need a hint to tell you that there's more content available "to the right". The role treegrid solves that by introducing columns which tells you there is more content to the right. I guess we can solve it by either changing the role completely or perhaps using group as a middleman between the treeitem and the tree. Maybe aria-keyshortcuts can help. I'm not sure, but what I'm sure of is that we need something more to tell the user more options are available and how they access them.
They are tightly coupled; the roles expect some keyboard actions to be implemented ⌨️
Yes, I think it would be easiest for us as well. I think we currently are close to what's best for our needs. I'm not aware how much actions are used but I guess the use is pretty slim since they don't seem to work as expected currently and no issues seems to have been issued yet. It would be awful if they required us to change everything because of them.
That's applicable to other things regarding web so nothing new 😆 As I said earlier, I think we are close to something which is well implemented. Even if we have some special cases, we are close to how the examples from W3 are implemented. And most of the aria-attributes should be well supported, nothing fancy. It's just the part with actions that probably will require some more potentially "quirky" solutions. In Europe/EU public sector sites are now by law required to ensure their sites are accessible. Not sure this is the best link covering that but if you're interested it's a summary at least: https://developer.paciellogroup.com/blog/2018/04/eu-directive-on-the-accessibility-of-public-sector-websites-and-mobile-applications/ The site we plan on using this component on is such a site. So, it will probably will be audited by third party to ensure compliance. |
Agree with everything you say. And it's good to have a real-world use case. As far as actions go, we use them internally and the global handler works for the team using it.
I'm open to trying out things. I currently don't have much time to research this so I'll leave to your capable hands to best tackle this. Do you mind opening a similar RFC for keyboard nav? Or do you think we should add the keys and effects in the readme? |
Not sure how much time I want to spend with this though. We don't use actions ourselves so this would be as a courtesy to get the PR:s through. We've already talked internally to build our own component instead since none (on npm) seems to cover WCAG & hierarchy-support. |
I understand and I don't want to spend more time than necessary either. I think we have clarity on most parts, the RFC suggestion was merely to solidify specs. Let me know if you want to go through with the PRs though. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
🎉 This issue has been resolved in version 1.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
react-dropdown-tree-select is a composite component, i.e. it's a combo of many HTML elements working in tandem. There is no WAI-ARIA guideline that covers something like this, so this component tries to adhere to guidelines for the constituent elements.
Here is a breakdown of the constituent elements:
role="combobox"
-
aria-autocomplete="list"
-
aria-haspopup="true"
-
aria-activedescendant
aria-owns
-
aria-controls
see w3c/aria/issues/716)
aria-haspopup="true"
-
aria-expanded
aria-owns
-
aria-controls
see w3c/aria/issues/716)
ul
)role="tree"
-
aria-multiselectable
role="treeitem"
-
aria-level
-
aria-expanded
-
aria-setsize
-
aria-posinset
-
aria-selected
aria-expanded
role="checkbox"
-
aria-checked
role="button"
-
aria-labelledby
Partially fixes #216
The text was updated successfully, but these errors were encountered: