-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix screen readers not announcing updated aria-describedby
in Firefox
#51035
Fix screen readers not announcing updated aria-describedby
in Firefox
#51035
Conversation
Size Change: +746 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
Flaky tests detected in fc69115. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5108593137
|
@kevin940726 Now that our React version is newer, If this is a bad solution, we might try rendering the Thanks. |
@alexstine Thanks for taking a stab! I think I have a different solution in efa7fdd which forces recomputation with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work well on Windows. Bug is no longer an issue in Firefox. Nice job tracking this one down. Hopefully we can get some support from Firefox to fix this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed explanation and jsfiddle
@kevin940726, this is testing well for me with VoiceOver running on macOS, and nice idea abstracting it into a small separate component. LGTM! ✨
I'm going to merge this. If anyone can point me to any related issues in Firefox please do 🙇♂️! If there's none, I'm also happy to file one or contribute if someone can guide me through where the relevant code base is. ❤️ |
Looks like this would be a good place to start: https://codetribute.mozilla.org/projects/a11y |
…ox (WordPress#51035) * Fix aria-describedby not updating content * Try aria-description. * Try a different approach * Fix missing prop --------- Co-authored-by: Alex Stine <[email protected]>
What?
Originally discovered and reported by @alexstine in #50422 (review). This PR fixes the issue where screen readers in Firefox fail to announce updated changes when the content of an element referenced by the
aria-describedby
attribute is updated.Why?
It's important to make sure screen readers get the correct and expected experience.
It is crucial to ensure that screen readers provide the correct and expected experience for users.
I investigated this issue further and found that it appears to be a bug specific to Firefox, as it is only reproducible in Firefox. The following conditions must all be met for the issue to occur:
aria-*
attribute that references an element's ID, such asaria-describedby
oraria-labelledby
.aria-*
attribute must be hidden from assistive technology, for example, throughdisplay: none
,aria-hidden="true"
, orhidden
.span.textContent = 'Updated changes'
works fine, butspan.childNodes[0].nodeValue = 'Updated changes'
does not. This issue is particularly noticeable in modern frontend frameworks like React, which always updates the smallest possible node for simplicity and performance.How?
To fix this issue, we only need to modify one of the conditions mentioned above. Since we need to support Firefox and screen readers, we cannot change conditions (1) and (2). Modifying (3) is also tricky because it sometimes double-announces the description if it's accessible to screen readers.
I created a
<AriaReferencedText>
component in this PR to leverage (4) to force a recomputation oftextContent
when the text changes. It triggers Firefox to acknowledge the changes and announce the correct value.This might not be the best solution, so I also want to seek insights from the Firefox accessibility team to understand the root cause of this issue. If we all agree that it is a bug, we may be able to address it in a future Firefox release.
Testing Instructions for the minimal reproducible jsfiddle
I created a jsfiddle to demonstrate the issue. Be sure to open it in Firefox and follow these steps.
textContent
directly. The screen reader should announce "Updated! Everything works correctly".textNode
. The screen reader should announce "Not updated, something is wrong".Testing Instructions for the List View in gutenberg
Screenshots or screencast
List view screencasts:
before.mp4
after.mp4
jsfiddle screencast:
Kapture.2023-05-29.at.10.12.28.mp4