You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React Native requires accessible={true} prop to be set on View elements to announce role prop. However, the accessible prop is not exposed by RSD.
The only way in where role works correctly in RN with RSD is:
Text elements behave as if accessible={true} by default
When using Pressable, it sets accessible={true} on the renderer View element. Using onPress handler with RSD triggers using Pressable instead of plain View.
These two cases are frequent enough that they avoid the problem in most cases, but unfortunately, not all.
A simple solution would be to have the role prop (perhaps excluding none/presentation) set accessible to true. However, that creates an issue in the iOS environment, which generally does not support nested accessibility elements. If there are two nested Views with accessible prop, only one is recognized (the ancestor one).
Expected behavior
There should be a way of controlling accessible prop. Perhaps a reasonable default would be to set it to true when role is not none/presentation. However, given the iOS issue described above, there should be a way to disable the status of accessibility element (on a parent), as it might prevent children from receiving a11y focus.
Steps to reproduce
Render <html.div role="heading"> element, without onClick handler.
Compare with the case when you set onClick handler, with renders accessible prop through Pressable component
Use a screen reader to navigate to the button
Role is not being announced
RSD.Role.Repro.mp4
Notice the header role announced on elements with accessible prop, and not announced otherwise.
Describe the issue
React Native requires
accessible={true}prop to be set onViewelements to announceroleprop. However, theaccessibleprop is not exposed by RSD.The only way in where
roleworks correctly in RN with RSD is:Textelements behave as ifaccessible={true}by defaultPressable, it setsaccessible={true}on the rendererViewelement. UsingonPresshandler with RSD triggers usingPressableinstead of plainView.These two cases are frequent enough that they avoid the problem in most cases, but unfortunately, not all.
A simple solution would be to have the
roleprop (perhaps excludingnone/presentation) setaccessibleto true. However, that creates an issue in the iOS environment, which generally does not support nested accessibility elements. If there are two nestedViews withaccessibleprop, only one is recognized (the ancestor one).Expected behavior
There should be a way of controlling
accessibleprop. Perhaps a reasonable default would be to set it to true whenroleis notnone/presentation. However, given the iOS issue described above, there should be a way to disable the status of accessibility element (on a parent), as it might prevent children from receiving a11y focus.Steps to reproduce
<html.div role="heading">element, withoutonClickhandler.onClickhandler, with rendersaccessibleprop throughPressablecomponentRSD.Role.Repro.mp4
Notice the
headerrole announced on elements withaccessibleprop, and not announced otherwise.Test case
https://github.com/mdjastrzebski/rsd-role-repro
Additional comments
No response