Conversation
6441414 to
3a39359
Compare
There was a problem hiding this comment.
There are various recommendations in the W3C example which probably apply to our usage, since that example is for a tree used as navigation which is what we're doing here.
I recommend we follow that example, including add a nav parent to the tree list (instead of the current div), and additional recommendations such as using the aria-current attribute etc.
Note that not everything in the live example has a corresponding textual recommendation - but IMO we should treat the example's aria attributes as best practice anyway. I've marked some (but not all) of the differences between their example and this implementation in separate PR comments.
We can however ignore some of the recommendations from that example that are for regular websites, such as the use of the banner landmark.
I will note that Orca (the screen reader I'm using for testing) works really well both in terms of correctly announcing tree items and the tree itself and in terms of respecting correct key bindings with the W3C example than with our site tree. In our one orca didn't seem to recognise it was in a tree at all, and wouldn't respect the left/right arrow keybindings.
| ><ins class="jstree-icon font-icon-right-dir" | ||
| role="button" |
There was a problem hiding this comment.
We should just use a semantic button element instead of an inserted text element which is just completely symantically incorrect.
While screen readers should use the role attribute, some won't (unfortunately orca which I'm using to test is one that won't) so we should use semantically correct HTML elements wherever possible.
There was a problem hiding this comment.
That said - in the W3C example the arrows aren't actually separately tabbable - instead the treeitem intercepts key presses for left/right arrows for expanding/collapsing, and the arrow is just a span with a click handler for mouse interaction.
This is more consistent with the keyboard interaction recommendations W3C make (it makes no mention of tab or enter for expanding/collapsing child nodes). Perhaps we should follow their example here as well?
There was a problem hiding this comment.
I'm not going to change HTML tags (will affect styling) or tab order (will affect behat tests) in this PR - I've created a follow up issue for this
There was a problem hiding this comment.
It feels like you might have not seen the second comment there, about making these not tabbable and not using the button role? If we do that, it doesn't really matter what the HTML tag is because assistive technologies will ignore them anyway - they'll only be for mouse interaction for sighted users.
There was a problem hiding this comment.
As previously mentioned, changing either the html tags or the tab order will affect styling / css and behat and I do not want to that in this PR as this one is focused on aria attrs. I have created a follow up issue to implement those.
There was a problem hiding this comment.
This is nearly the only problem now with what the screen reader is saying. Whenever I tab to one of these button-not-buttons, it leaves the context of the tree. The screen reader changes to "browse mode". When I tab back off it, it enters the context of the tree again, and I get told all the tree information (level 2, etc).
What interactive elements live where very much impacts the screen reader experience - it's hard to say "yes this is done the screen reader experience is good now" when this interactive element is interfering with that experience. These two things inform one another.
I guess I have to call it done and then when the follow up issue is implemented, I have to check it again and see how it impacts the screen reader experience? And then if more changes are needed to the aria attributes, we'll open another separate card to address it separately again?
templates/SilverStripe/CMS/Controllers/Includes/CMSMain_TreeView.ss
Outdated
Show resolved
Hide resolved
templates/SilverStripe/CMS/Controllers/Includes/CMSMain_TreeNode.ss
Outdated
Show resolved
Hide resolved
templates/SilverStripe/CMS/Controllers/Includes/CMSMain_SubTree.ss
Outdated
Show resolved
Hide resolved
e971648 to
75a3ff2
Compare
GuySartorelli
left a comment
There was a problem hiding this comment.
The experience with a screen reader still isn't the same or as good as the W3C example. Are you using a screen reader to test this?
One clear example is when I use left/right arrow keys to expand/collapse a node, with the W3C example the screen reader announces "collapsed" or "expanded" as appropriate. With this PR I get no feedback at all.
I again recommend we follow the W3C example as closely as we can.
| ><ins class="jstree-icon font-icon-right-dir" | ||
| role="button" |
There was a problem hiding this comment.
It feels like you might have not seen the second comment there, about making these not tabbable and not using the button role? If we do that, it doesn't really matter what the HTML tag is because assistive technologies will ignore them anyway - they'll only be for mouse interaction for sighted users.
75a3ff2 to
1d05442
Compare
|
Have moved all the aria stuff off the |
GuySartorelli
left a comment
There was a problem hiding this comment.
There's a merge conflict.
The only other thing remaining that bothers me (other than the <ins> stuff) is the level starts at level 2? Feels like the root level pages should all be level 1.
| ><ins class="jstree-icon font-icon-right-dir" | ||
| role="button" |
There was a problem hiding this comment.
This is nearly the only problem now with what the screen reader is saying. Whenever I tab to one of these button-not-buttons, it leaves the context of the tree. The screen reader changes to "browse mode". When I tab back off it, it enters the context of the tree again, and I get told all the tree information (level 2, etc).
What interactive elements live where very much impacts the screen reader experience - it's hard to say "yes this is done the screen reader experience is good now" when this interactive element is interfering with that experience. These two things inform one another.
I guess I have to call it done and then when the follow up issue is implemented, I have to check it again and see how it impacts the screen reader experience? And then if more changes are needed to the aria attributes, we'll open another separate card to address it separately again?
| // Add role="tree" to the root level <ul> for accessibility | ||
| // This needs to be done with JS as jstree will override any attributes set server-side | ||
| $('.cms-tree > ul').entwine({ | ||
| onmatch: function() { | ||
| this.attr('role', 'tree'); | ||
| } | ||
| }); |
There was a problem hiding this comment.
We should probably use one of the jstree events, such as loaded.jstree (similar to other events already in silverstripe/silverstripe-admin#2016)
8f458be to
ebfc0e6
Compare
ebfc0e6 to
5ea51f7
Compare
Issue silverstripe/silverstripe-admin#2000