Problem/Motivation
When @cboyden's team did an assistive tech walkthrough of Media Library for #2834729: [META] Roadmap to stabilize Media Library using NVDA on Firefox, we discovered that, when making selections of items in the library, if you have met the max and remaining items are grayed out (disabled), a screenreader user is still able to select the disabled items, hearing them as "clickable".
This problem is only present if you are using a screenreader (tested with NVDA). This is not something that a mouse user will encounter because the disabled items cannot be clicked by the mouse to select. Keyboard-only users cannot select the items either.
This problem becomes especially confusing because the screenreader user is not given any kind of warning or alert that they have made selections beyond what is possible. Once they select more than the limit, the remaining items are no longer disabled and grayed out, so they might select an unlimited number. The system does not show an error message in the modal when more than the limit are selected.
After activating "Insert selected" button, the system announces "Added X media items," but the field is actually empty. If they go so far as to save the node, then it saves, but no media is added. The error that should have appeared on the modal displays on the node page, but is not announced.
This interaction can be viewed on the video recording of the September 29, 2019 walkthrough of Media Library starting at around minute 6:30 and continuing to minute 9:45..
Proposed resolution
TBD
Remaining tasks
- Determine resolution and implement.
User interface changes
The way that the Media Library presents each selectable media item may need to be adjusted slightly so that the entire element, including the image and the checkbox, are only available through keyboard access as a single element.
API changes
None anticipated.
Data model changes
None anticipated.
Release notes snippet
TBD
Comment | File | Size | Author |
---|---|---|---|
#31 | 3084560-nr-bot.txt | 149 bytes | needs-review-queue-bot |
#19 | interdiff_15-19.txt | 6.73 KB | bnjmnm |
#19 | 3084560-19.patch | 9.58 KB | bnjmnm |
#15 | 3084560-15.patch | 9.03 KB | bnjmnm |
#15 | interdiff_13-15.txt | 2.52 KB | bnjmnm |
Issue fork drupal-3084560
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
cboyden CreditAttribution: cboyden at UC Berkeley Web Platform Services commentedUpdated issue summary - added details of screenreader interaction and error messages. We weren't able to trigger the error with the keyboard on Chrome or Firefox on Mac.
Comment #3
bnjmnmAlthough I can't reproduce the exact error on my Mac using Voiceover, I could select more than my share of items by navigating with voiceover to parts of a disabled element using VO-arrow (not Tab navigation) then hitting return on any element other than the checkbox field.
The issue summary reporting NVDA announcing "clickable" suggests this is due to a click event listener still being present on the Media Item, even if clickability/keyboard nav is disabled. This patch removes the click listener when the item is disabled, and returns it if it becomes re-enabled. This fixed the similar issue I experienced with Voiceover, but I'll need confirmation from someone experiencing the exact issue reported to confirm it is fixed for them as well. It would also be good to know if there's a better way of communicating what is happening to screenreader users - this patch should put out the fire of too many items being added but the screenreader experience is largely unchanged (aside from hopefully eliminating the "clickable" said by NVDA).
Comment #5
bnjmnmFixed the test failure which exposed:
Comment #6
rainbreaw CreditAttribution: rainbreaw as a volunteer commentedI'm pinging @cboyden to review this one
Comment #8
cboyden CreditAttribution: cboyden at UC Berkeley Web Platform Services commentedLucy and I reviewed the patch. The disabled elements are still announced as "clickable," but, clicking on the "clickable" elements no longer does anything. The NVDA user is no longer able to select more items that are allowed by the field.
For each library item, there are two clickable elements that are available when using NVDA's arrow navigation. Either one works to select the item. It would make for better screenreader usability if there were only one actionable element per media item.
Comment #9
rainbreaw CreditAttribution: rainbreaw as a volunteer commentedThank you @cboyden and Lucy for reviewing and confirming that the essential problem of this issue is resolved. I have created a new issue — #3087528: Adjust the listed items available in the media library so that there is only one clickable/focusable element per item — targeting the additional challenge that you reported in comment 8.
Comment #10
rainbreaw CreditAttribution: rainbreaw as a volunteer commented(comment removed)
Comment #11
phenaproximaLooks like this needs to be rerolled.
Comment #12
oknateReroll of #5 (only).
One thing I noticed:
console.log should be removed.
Comment #13
Dinesh18 CreditAttribution: Dinesh18 at Singapore Press Holdings commentedHere is the patch which removes the console.log. Kindly review.
Comment #14
phenaproximaTagging this important bug fix to be worked on at DrupalCon Amsterdam.
Comment #15
bnjmnmTested on NVDA and was able to address the disabled items having content still reported as "clickable"
Comment #16
bnjmnmTagging this with "needs manual testing" -- it's not possible to cover this with FunctionalJavascript tests as the problem is only present when screenreaders are enabled.
With NVDA enabled, it becomes (pre-patch) possible to tab into the disabled media items and the return key would select the item.
With Voiceover, the items can't be accessed via tab navigation, but can be via VO-arrow, and the return key can select the item as well.
Comment #17
phenaproximaNit: Can these things be separated by an empty line?
Also, I'm not sure about the naming of clickToSelectTriggerEvent. I would probably go with something like
onSelectMediaItem
or similar, since it is an event handler.Nit: I think all of these
attr
calls can be combined into one, sinceattr
accepts an object of key-value pairs.One thing I'm not certain about it setting the
onclick
attribute to a string of JavaScript. Can't we just use.on('click', () => return false)
?Another thing here is that I'm not sure we need the
onclick
stuff at all. Isaria-disabled
not sufficient for our purposes?One final request is for this to get a nice long comment documenting what we're doing and why. :)
Comment #18
seanBI was also thinking about this. We should actually remove href attribute from the link, or maybe even remove the link entirely for disable items. I think removing the href would already be enough and setting a data-href attribute temporarily for disabled items could be a nice workaround.
This would also solve
Lucy and I reviewed the patch. The disabled elements are still announced as "clickable," but, clicking on the "clickable" elements no longer does anything. The NVDA user is no longer able to select more items that are allowed by the field.
from #14.Comment #19
bnjmnmAddressed the feedback in #17
Great call in #18 on removing href, that takes care of it and the JS is cleaner. However, it should be mentioned that I discovered that these links don't even work in dialogs in #3087528: Adjust the listed items available in the media library so that there is only one clickable/focusable element per item. My proposal there is to change those to regular text, which would impact this solution. For now, the hrefs are getting removed and that seems to work well.
Comment #21
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedI have tested this issue in Drupal 9.1.x-dev with "Orca Screen Reader"(through keyboard). I could select only the allowed number of items. When I selected the allowed number of items, all the other items were disabled for selection but we can navigate through those disabled items. The disabled items were still announced as "clickable", but actually clicking on those "clickable" items no longer does anything.
Video Link:https://drive.google.com/file/d/1pxO3AvSmCtYsrdPEIQQrFpwFPgwfbTsJ/view?usp=sharing
Comment #22
phenaproximaComment #23
janmejaig CreditAttribution: janmejaig at Srijan | A Material+ Company for Drupal India Association commentedI have check above issue and found that , this issue is related to "issues-3059955" . Once this related issue(3059955) will get resolved this ticket will be also get resolved .
Comment #31
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.