Make WordPress Core

Opened 2 months ago

Last modified 3 weeks ago

#64375 new defect (bug)

Set `word-break` property in screen reader only css.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by:
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-refresh
Focuses: accessibility, css Cc:

Description

While using the screen-reader-only class from WordPress recently, I noticed that the word-break property set to a value other than normal can cause VoiceOver to read text strangely.

In the example I experienced the phrase "read text" was read as "R E A D space T E X T" due to an inherited word-break: break-word.

In WordPress Core, I think we should add word-break: normal !important to CSS hiding elements from all but screen reading devices.

Change History (7)

This ticket was mentioned in PR #10610 on WordPress/wordpress-develop by @peterwilsoncc.


2 months ago
#1

  • Keywords has-patch added

Adds word-break: normal !important to various screen reader only CSS.

This prevents screen readers from announcing the text as it would appear visually, eg "A P P E A R space V I S U A L L Y".

Trac ticket: https://core.trac.wordpress.org/ticket/64375

#2 @peterwilsoncc
2 months ago

I've noticed some inconsistencies how these are styled across various locations, I presume because best practice has changed over the years. It would be good to make them consistent using the currently recommended method.

@joedolson Do you have a suggestion for the most accessible CSS to use?

#3 @manhphucofficial
2 months ago

I’m supportive of this fix.
Adding word-break: normal !important to screen-reader-only text is a sensible safeguard, as inherited break-word can cause the letter-by-letter announcements described above. The change looks low-risk, improves consistency, and doesn’t alter visual output.

A follow-up to standardize the various visually-hidden patterns across Core would also be helpful. Happy to help test any future refinements.

#4 @palak678
7 weeks ago

This change makes sense from an accessibility perspective. Adding word-break: normal !important ensures screen-reader-only text is read as complete words instead of being split unnaturally, which improves the overall screen reader experience.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


3 weeks ago

#6 @joedolson
3 weeks ago

See prior discussion on #48533. This was an oversight, and should be added into the core class and propagated through all other usages.

#7 @sabernhardt
3 weeks ago

  • Keywords needs-refresh added

The PR will need a refresh after [61469], and Twenty Twenty-One's .map files might require updating too.

Note: See TracTickets for help on using tickets.