fix: Ensure aria-hidden applies to shadow root #315
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Relates to: https://github.com/github/pull-requests/issues/17192
Problem
When
aria-hidden="true"
is set on an relative-time element, the attribute doesn't always persist into the shadow root. As a result, even whenaria-hidden
is applied, the text rendered in relative-time can end up composing the accessible name (instead of being hidden from the AT tree).Solution
This makes update to render the text content within
aria-hidden="true"
, whenaria-hidden="true"
is set on the shadow root.Demo
Before (no sound):
Before.mp4
video description: I'm on the demo page with the developer console open. The markup shows
aria-hidden
being toggled between true and false relative-time upon pressing the button. I switch to the accessibility tree mode. I see the accessible name for the button remains:With aria-hidden on Dec 31, 1969
despite toggling.After (no sound):
After.mp4
video description: I'm on the demo page with the developer console open. The markup shows
aria-hidden
being toggled between true and false relative-time upon pressing the button. I switch to the accessibility tree mode. I see the accessible name for the button toggle between:With aria-hidden on Dec 31, 1969
andWith aria-hidden
as we'd expect.