-
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
Rich Text: Add aria-readonly attribute to Rich Text component #58687
Conversation
Size Change: -730 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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've tested it, and it seems to work as expected 🙂
What?
To improve accessibility on Block Bindings elements that use Rich Text components with the
contenteditable
attribute, this PR adds thearia-readonly
attribute to them.Why?
This follows an accessibility recommendation mentioned here and can help ensure that elements with bound content attributes via the Block Bindings API, namely paragraphs, headings, and buttons, are marked up correctly as the ability to edit them toggles on and off.
Please note that this PR is simply meant to address low-hanging fruit regarding the markup and does not address the screen reader behavior outlined in the issue above.
How?
It adds the
aria-readonly
attribute to theRichText
component.In addition, it adds a check that was missing to ensure that we only add the attribute to blocks that support bindings.
Testing Instructions
Blocks that Support Bindings
functions.php
aria-readonly
attribute has been added with a value oftrue
Additionally, test steps 2-4 for the heading and button blocks using the following markup:
Heading
Button
Blocks that Don't Support Bindings
I'll just illustrate one block that uses Rich Text and doesn't support bindings here, namely the list block, but you could test others:
aria-readonly
attribute has a value offalse