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

fix: allow pass-through of accessibilityRole prop on Button.tsx #4092

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

meatnordrink
Copy link
Contributor

@meatnordrink meatnordrink commented Sep 21, 2023

Summary

In cases where a button is used because it is stylistically desired, but the onPress event opens a link, we should be able to set the accessibilityRole of the button as link for screen readers. Otherwise, it should remain button by default.

The inclusion of an icon or styling can indicate link behavior to a sighted user, but is not detectable by a screen reader.

Test plan

  • Pass accessibilityRole='link' as a prop to a button, and navigate to the button via screen reader. It should announce as a link.
  • Do not pass any accessibilityRole prop, and navigate to the button via screen reader; it should announce as a button.

I have tested this locally, and it works as expected.

@callstack-bot
Copy link

callstack-bot commented Sep 21, 2023

Hey @meatnordrink, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@lukewalczak
Copy link
Member

Hey @meatnordrink, could you please resolve the conflict?

@lukewalczak lukewalczak added this to the 5.12.0 milestone Nov 28, 2023
@lukewalczak lukewalczak merged commit 220ae16 into callstack:main Jan 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants