Repository navigation
fix: List item screen reader announcement for read-only editor (BLO-1217) - #3223
Open
matthewlipski wants to merge 1 commit into
Open
matthewlipski wants to merge 1 commit into
matthewlipski wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When the editor is read-only, list item blocks aren't properly announced as being list items or belonging to any list. This PR gives list item blocks the
listitemrole, and adds alistItem: booleanfield to themetaproperty so custom blocks can be flagged as list items to receive the role automatically. This lets screen readers know that an element is a list item without it being alielement, so the following HTML snippets are equivalent:However, this doesn't fully solve the issue as list item blocks don't share a common ancestor list block/element, so there is no
ul/role="list"to group list items by. The way around this is thearia-ownsattribute, which tells assistive technologies that an element is semantically the ancestor of some other elements, even though it isn't in the DOM. So the snippet below is also equivalent to the ones above:So this PR also adds a
divwitharia-ownsbefore each each consecutive string of list item blocks of the same type.All of what's described above, i.e. setting
role&idattributes on list item blocks as well as creating an invisibledivwithrole="list"andaria-owns, is done in theListAccessibilityExtensionvia decorations.The editor
rolehas also been changed fromtextboxtodocumentwhen the editor is read-only as the list item changes otherwise cause issues with VoiceOver. This would need further investigation if we wanted to apply this fix always, but #2809 only requires the fix for a read-only editor.Closes #2809
Rationale
List items are not properly read out by screen readers when the editor is read-only.
Changes
See above.
Impact
N/A
Testing
Updated default document for screen reader tests to also test lists. Screen reader tests remain skipped for the time being. Axe scans do not catch this issue as list item blocks are rendered using
pelements, so they are just seen as paragraphs and list item rules don't apply.Screenshots/Video
For the following editor structure:
Below are VoiceOver transcript snippets when announcing the blocks.
Before:
The
"Insertion at beginning of text. list box pop-up edit text"is due to the editor'stextboxrole, which announces that the content is editable even though it is not.After:
The list items are now properly announced as such, and as being part of the same list.
Checklist
Additional Notes
N/A