A11y: aria-label text not visible in editor for Pagination Block if "showLabel" is unchecked #51335
Labels
[Block] Query Pagination
Affects the Query Pagination Block - used for pagination within the Query Loop Block
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Status] In Progress
Tracking issues with work in progress
[Type] Copy
Issues or PRs that need copy editing assistance
Description
There is a new feature to hide the label of Query Pagination Previous Block and Query Pagination Next Block inside the Query Pagination Block: #50779
We just tested this feature for accessibility. If I hide the label text, the block's text value will be used as
aria-label
on the previous and next buttons instead. This is fine behaviour.But from an editor's view, it could be problematic that an editor won't know this unless he checks the frontend for accessibility. The
showLabel
option's label just says: "Toggle off to hide the label text, e.g. 'Next Page'." It does not give any indication that the text value will still be present in the HTML document and accessible for screen reader users. There is also no indication what the visually hidden values are, as they are completely removed from the editor once the option is enabled.A possible real life scenario:
An editor inserts the Query Pagination Block and plays around with the previous and next labels. They write some funny text or insert Unicode characters because they want to display arrows. Then they notice the option to hide the labels and just use the preset icons instead. This is exactly what they want, and the experimentally changed texts are now hidden. In the frontend everything looks fine for visual users but screen reader users would read the non-appropriate aria-labels, not explaining what the links do.
A suggestion would be to explain to the editor that the values will still be rendered in the HTML document instead of just the current message: "Toggle off to hide the label text, e.g. 'Next Page'.". For example: "Toggle off to visually hide the label text, e.g. 'Next Page'. The text will still be used for screen readers."
We could also even dynamically display the real text values instead of just "e.g. 'Next Page'" in the Block settings.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Backend
Frontend
Environment info
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: