Opened 2 months ago
Last modified 3 weeks ago
#64375 new defect (bug)
Set `word-break` property in screen reader only css.
| Reported by: |
|
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
#2
@
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
@
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
@
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.
Adds
word-break: normal !importantto 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