Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block library: Remove focus style on screen-reader-text #33726

Closed
wants to merge 1 commit into from

Conversation

walbo
Copy link
Member

@walbo walbo commented Jul 28, 2021

Description

Remove focus style on screen-reader-text. The focus styles are intended mainly for skip links, not just anything with the class.

Fixes #33724

How has this been tested?

Tested the core ticket https://core.trac.wordpress.org/ticket/53803
Tested that skip-link works as expected
Tested blocks that uses screen-reader-text works as expected (ex categories with dropdown)

Screenshots

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@jasmussen
Copy link
Contributor

Thanks for the PR!

Those screen reader focus styles were added in #30141, it appears very intentionally so, to address an issue with the Archives block.

@carolinan you had some good thoughts in that thread, can you help me sanity check this PR? From what I can tell, we need the focus style to remain on the archives screen reader text, but what's the best path forward? Should the class be scoped further? Or should something be changed in the customizer? Thank you for looking.

@walbo
Copy link
Member Author

walbo commented Aug 4, 2021

I think a11y requirements is still met by removing the focus style. As @carolinan says in #30141

Screen-reader-text can be, but is not always visible on focus, the skip link is always visible on focus.

Current implementation always add visible focus style. Block that need the focus style should add it. Maybe scoped helper classname for it?

The screen-reader-text in the archive block was removed in #30527. core/categories, core/post-comments-link and core/search still uses screen-reader-text but I belive none of those needs visible focus.

@jasmussen jasmussen requested a review from gziolo August 5, 2021 12:46
@gziolo
Copy link
Member

gziolo commented Aug 5, 2021

Those styles follows the accessibility guidelines for WordPress:

https://make.wordpress.org/accessibility/handbook/markup/the-css-class-screen-reader-text/

@joedolson
Copy link
Contributor

The fact that skiplinks use :focus directly on .screen-reader-text rather than using a helper class like is-focusable or skiplink is something I'd consider a questionable decision in the history of how WordPress handles skiplinks. Hiding text that's only intended for screen readers should not automatically come with the assumption that it should become visible when focused.

I think it's very feasible to have an option for screen-reader-text to become visible via a helper class, but it's not beneficial for that to always be the case. We should be able to be selective about whether or not screen reader text will become visible on focus.

@gziolo I wouldn't call that document 'style guidelines' - it's informational, informing users what the recommended CSS for hiding screen reader text is, if you're going to do that. A CSS class for hiding screen reader text should use that CSS, and a class for making screen reader text focusable should be similar to the :focus styles indicated, but that's the extent there.

@skorasaurus skorasaurus added the Needs Accessibility Feedback Need input from accessibility label May 10, 2022
@priethor priethor added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). and removed [a11y] Keyboard & Focus labels Jul 24, 2023
@walbo walbo closed this Jan 8, 2025
@walbo walbo deleted the fix/screen-reader-text-focus branch January 8, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Package] Block library /packages/block-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen reader text in block library shouldn't be visible on focus
7 participants