Issue metadata
Sign in to add a comment
|
ChromeVox linear navigation gets stuck in input text fields with associated labels when aria-hidden changes |
||||||||||||||||||||||||
Issue descriptionChrome Version: 65.0.3325.209 OS: Chrome OS What steps will reproduce the problem? (1) Open the jsfiddle example here (or open a page with the example HTML listed below): https://jsfiddle.net/7cm0fmfp/ (2) Start ChromeVox (3) Click on the text field in the example (4) Use linear navigation (search + right arrow key) to try to move out of the text field What is the expected result? The screen reader is able to continue linear navigation to other elements. What happens instead? The screen reader gets stuck in a loop going back to the text field repeatedly on linear navigation. This makes it difficult to navigate away from the text field without using tab. This appears to be related to toggling aria-hidden on the associated label upon entering/exiting the input field. If you comment out the associated JS that does this, linear navigation works as expected. Example HTML to replicate the issue: <input id="f1" type="text" class="field"> <p id="helper" for="f1" aria-hidden="true">Error in field</p> <script> const inputEl = document.getElementById('f1'); const helperText = document.getElementById('helper'); inputEl.addEventListener('blur', function() { helperText.setAttribute('aria-hidden', true); }); inputEl.addEventListener('focus', function() { helperText.setAttribute('aria-hidden', false); }); </script>
,
Apr 30 2018
,
May 1 2018
It's not clear to me why you're toggling aria-hidden. By removing the helper text anytime except when the input box is focused, you make it almost impossible for a screen reader user to actually read it. I also don't believe that the for="f1" attribute is valid markup on a <p>, it's only valid on a <label> element from what I understand. I'd propose this markup: <input id="f1" type="text" class="field" aria-errormessage="helper" aria-invalid="false"> <p hidden id="helper" role="alert">Error in field</p> Then when there is an error in the entry, change aria-invalid to true, and remove "hidden" to show the message to all users and announce it to screen reader users. ChromeVox will automatically announce anything with role=alert when it appears, and aria-errormessage is relatively new and won't do anything yet but it's the correct markup and will allow us to do something even more semantically relevant in the future. ---- Completely separately, I do think it'd be a good idea to fix ChromeVox to be a bit smarter in this case - we have some code that tries to "recover" when the node we're about to navigate to disappears, and I think that's why it's looping. Assigning to David to see if we can do better in this case.
,
May 1 2018
Thanks for the reply. The for in the <p> was indeed an accident (copied in from a label by mistake). We're actually doing something a bit different than the example, but simplified for replication. This is no longer an issue for us in this case as we've now stopped toggling aria-hidden. However, I did just discover another odd case where the screen reader gets stuck during linear navigation that I thought might be worth mentioning. I'm not sure what is actually causing this, but I found this through a pretty specific use case involving having an icon next to a text field. In this setup below, if you set role to alert for a label associated with a text field on text field blur when the role is already set, then the screen reader gets stuck in a loop with linear navigation upon exiting the text field. We're avoiding this by only setting it when necessary, but wasn't sure if this might be useful to help debug other issues. Example: https://jsfiddle.net/zzwyjyvs/ Thanks!
,
Jul 10
Don't do this. Setting aria-hidden literally destroys an entire DOM (that node and escendants). Once a subtree gets destroyed, ChromeVox has no way to recover systematically its position. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by rlfriedman@google.com
, Apr 30 2018