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

Accessibility: text-transform affects the accessible name #152

Open
mkrause opened this issue Feb 18, 2025 · 0 comments
Open

Accessibility: text-transform affects the accessible name #152

mkrause opened this issue Feb 18, 2025 · 0 comments
Labels

Comments

@mkrause
Copy link
Collaborator

mkrause commented Feb 18, 2025

By default we won't set an aria-label on things like buttons and rely on the text content instead. We also use text-transform: uppercase to visually display the text as all-caps.

Image

It turns out that text-transform also affects the accessible name. This leads to some issues where, for example, a screen reader would read "Call Us" as " Call U.S." instead.

As a possible fix, we could consider to automatically apply an aria-label to these elements with the untransformed name. This would override the text content:

Image

Note that this is only possible if we have a string label available. If the consumer gives us an arbitrary ReactNode, then this won't work. In such cases, either the consumer would need to manually set an aria-label, or we could consider an alternative approach with a hidden element and an aria-labelledby="some-id" attribute.

@mkrause mkrause added the a11y label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant