FormidableLabs / eslint-plugin-react-native-a11y

React Native specific accessibility linting rules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: Rule to require accessibilityRole prop

Waltari10 opened this issue · comments

commented

In our project we often get bugs that the screenreader is not reading the type of pressed element correctly or not at all. This is typically fixed by adding accessibilityRole prop. I was wondering if it would be possible to require accessibilityRole prop for react-native components like text and button? Everything has accessible={true} prop anyway, so might as well.

Is this something that might be added in the future?

commented

hey @Waltari10 -- thanks for this suggestion.

as i understand it, there isn't always a clear-cut requirement that every <Touchable*> with accessible={true} always requires accessibleRole. my (current) understanding is it depends on both the child content of the <Touchable*> in question as well as the other accessibility props.

for instance, the component might include other props like accessibilityLabel and accessibilityHint that succinctly describe the behaviour without an explicit accessibilityRole. Here's an example of that taken from the AccessibilityExample in the main react-native repo.

so i don't think that's valid? 🤔 but i could be wrong...

commented

closing as stale -- please reopen if you wish to discuss further