Breadcrumbs block: Hide separator from screen readers#78524
Conversation
|
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. |
|
I have used this exact pattern when building my own breadcrumbs recently and can confirm that screen readers will skip over without reading the separator with this style rule pattern. |
talldan
left a comment
There was a problem hiding this comment.
This fixes the issue in testing for me. Thanks for the contribution!
What?
Closes #78523
Adds CSS content alt text syntax to the breadcrumbs block separator so screen readers treat it as presentational and do not announce it.
Why?
The breadcrumbs block uses a CSS pseudo-element to render the separator character between items:
The CSS
contentproperty supports an alt text syntax,content: value / "", where an empty string after the slash instructs assistive technologies to skip the generated content entirely. Without this, screen readers such as VoiceOver and NVDA announce the separator character (e.g. "slash") between every breadcrumb item, adding noise that is not useful to the user.How?
Single line change in
packages/block-library/src/breadcrumbs/style.scss:Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools
Claude (Anthropic) was used to assist in drafting the PR description.
The code change was authored and reviewed by the contributor.