Closed
Description
Describe the bug
react-native
built-in elements are not queriable with byRole
queries if you don't set the accessibilityRole
prop.
Expected behaviour
byRole
queries should be able to match some elements without accessibilityRole
.
We however need to be conscious of what roles should be used to match what elements. My suggestion is checking each element with a voice-over and see what matches:
- should
<Pressable />
bebutton
by default? <TextInput />
will readInput
on ios voiceover, but that is not anAccessibilityRole
as exported byreact-native
.
We might need to think about types. The point raised in #1127 (comment) that suggests using TextMatch
for the role will make it harder to discover those cases.
Steps to Reproduce
Unable to find an element with accessibilityRole: image
140 | const { getByRole } = render(<Image />);
141 |
> 142 | getByRole('image');
| ^
143 | });
144 | });
145 |
Versions
Latest.