Screen reader text supported
Basic principle
Accessibility-ready themes make it easier for content authors to create accessible websites. Themes must have a clearly defined and properly styled class, such as .screen-reader-text or .sr-only, that allows content creators to include text that is hidden visually but still read by assistive technologies without needing to write custom CSS.
Including a screen reader text class makes it easier for content creators to add additional context for links, buttons, or form fields when building with the theme.
See the required CSS for a screen reader text class.
Testing
Tools: Browser, browser inspector, text editor, screen reader (optional)
- Open the
accessibility.txtfile saved in the main theme directory. This can be opened in a text editor or in the theme file editor. If anaccessibility.txtfile is not present, this criterion can be considered a fail. - Find the Screen Reader Text Class section and see which class is being used for screen reader text (e.g.,
.screen-reader-text,.visually-hidden, etc.). - Open a post or page in the WordPress editor and insert a heading block.
- Type any text in the heading block.
- In the block settings > Advanced section, apply the correct screen reader text class to the block in the Additional CSS Class(es) field.
- View the post or page on the front end.
- Verify that the text in the heading block is not visible.
- Open the browser inspector and find the heading in the HTML section so you can inspect the related CSS.
- Verify that the text is hidden using the required CSS linked above.
- Optional: Listen to the page with a screen reader and confirm the hidden text is read.
WP Accessibility Knowledge Base