Fix accessibility of the Classic Edit modal dialog #50161
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block library
/packages/block-library
[Package] Components
/packages/components
[Type] Bug
An existing feature does not function as intended
Description
Since a few Gutenberg releases, the Classic Edit block opens in a modal dialog. The modal dialog lacks some important accessibility requirements:
1
The modal dialog is unlabeled.
There is an
aria-labelledby="components-modal-header-0"
attribute but it points to nothing. There have been quite a few unlabeled modal dialogs so far and this is one more instance. This can be fixed on a per-instance basis but, as pointed out in #47885, it would be best to fix the component in the first place to enforce a proper labeling.2
The 'Classic Edit' heading contains extraneous content.
The 'Cancel' and 'Save' button are placed within the heading. A heading should be a heading and only contain a meaningful title. Placing buttons within a heading isn't that great. The actual heading text becomes:
Classic Edit Cancel Save
which is arguably meaningful, if not confusing. See screenshot.
3
Minor:
<div>
elements within a heading is invalid HTML.4
The modal dialog heading should be a H1.
When the modal dialog component opens, we do hide from assistive technology all the rest of the content of the page by the means of
aria-hidden="true"
. Worth noting the aria-modal="true" would be more correct but at the time the component was implemented,aria-modal
was buggy. Regardless, the modal dialog content is the only content that is perceived by assistive technology. As such, it's best to start the headings hierarchy withih the dialog from scratch by using a H1.5
Tabbing is not constrained within the modal.
I'm guessing TinyMCE conflicts in some way with the builti-in focus management of the modal dialog component.
Step-by-step reproduction instructions
role="dialog"
.aria-labelledby
attribute is marked as 'invalid source', meaning there's no element with that ID.Classic Edit Cancel Save
.Classic Edit Cancel Save
. Screenshot:Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: