Improve a11y of Meta Description modal controls#445
Improve a11y of Meta Description modal controls#445dkotter merged 3 commits intoWordPress:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #445 +/- ##
==========================================
Coverage 67.41% 67.41%
Complexity 907 907
==========================================
Files 59 59
Lines 4352 4352
==========================================
Hits 2934 2934
Misses 1418 1418
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Show inline "Copied!" confirmation on the copy button instead of a snackbar notice so feedback is announced next to the triggering action. - Add accessibleWhenDisabled to disabled buttons so they remain focusable and discoverable by screen readers. - Drop disabled/isBusy from the initial Generate button so it stays actionable while the modal handles the loading state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The inline "Copied!" label change is silent for keyboard/screen-reader users because the button retains focus and screen readers do not re-announce a changed child text. Use speak() from @wordpress/a11y to deliver the confirmation through the shared live region. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Disable the Generate Meta Description button and mark it busy while a request is in flight so assistive tech users get the same state feedback as the Regenerate control, and to prevent duplicate requests.
e7ae595 to
37b5e87
Compare
|
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 If 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. |
| onClose: () => void; | ||
| } | ||
|
|
||
| function CopyButton( { |
There was a problem hiding this comment.
This implementation is almost identical to this one.
Part of #180
What?
This PR fixes some issues related to a11y in the meta description modal.
Why? How?
The key points of the problem and solution are as follows:
disabledattribute is added to the button. Buttons with thedisabledattribute are not focusable, leading to a loss of focus. To resolve this, theaccessibleWhenDisabledprop is available.speak()method that the copy action has been performed.Here are some additional changes I'd like to propose, but they are outside the scope of this PR.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Refactoring the copy button to match Gutenberg's
CopyButtonpattern and wiring upaccessibleWhenDisabled. All output was reviewed by me.Testing Instructions
Generate Meta Description
generate-buton.mp4
Close Meta Description Modal
Incidentally, since the "Generate Meta Description" button is a button to trigger a modal, the
isBusyanddisabledprops should not be necessary in the first place. Ideally, the description generation should be canceled when the modal is closed, but this is out of scope for this PR.close-modal.mp4
Copy Meta Description
Meta description copied to clipboard..copy.mp4
Changelog Entry