-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
♿ [amp-render] a11y change #34540
Merged
Merged
♿ [amp-render] a11y change #34540
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
49af13a
remove `buildCallback`, move code to `init`
dmanek 0c45238
Merge branch 'main' into amp-render-a11y
dmanek d816a42
Merge branch 'main' into amp_render_a11y
dmanek 08d9a0c
fix failing test
dmanek cb9f0a1
minor cleanup
dmanek 836fd74
adding aria-live attr on preact element
dmanek 6e82859
add aria-live attribute and unit tests
dmanek 52819f1
pass aria-live value from AMP to keep the values consistent
dmanek ae0611b
Merge branch 'main' into amp_render_a11y
dmanek 2e955d1
lint
dmanek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ export function RenderWithRef( | |
rendered && typeof rendered == 'object' && '__html' in rendered; | ||
|
||
return ( | ||
<Wrapper {...rest} dangerouslySetInnerHTML={isHtml ? rendered : null}> | ||
<Wrapper {...rest} dangerouslySetInnerHTML={isHtml ? rendered : null} aria-live="polite"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please propagate if an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
{isHtml ? null : rendered} | ||
</Wrapper> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Another question - does this have to be on the custom element? Can it be done in the Preact layer?
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.
If this attribute is added to the Preact layer, any changes to placeholder & fallback will not be announced by screen readers.
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.
I see. What about changes within the Preact component, such as actual data rendering into a template? I assume that will be announced by AMP because of this logic but not in Preact? If we add the attribute in Preact layer also, will it cause redundant announcements? If not, perhaps both locations is a good compromise.
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.
Yes, with the current logic any changes to the content including placeholder, fallback and rendered data will be announced. By moving it just to the Preact layer, it skips announcing fallback and placeholder updates.
I added the attribute to the Preact layer too and based on testing with VoiceOver on Mac, there are no redundant announcements. Guess that's a good compromise 🙂