-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Native ARIA Roles: Shared code #37305
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
Conversation
This pull request was exported from Phabricator. Differential Revision: D45431372 |
Base commit: 61335a1 |
fbd8251
to
e5d95b3
Compare
This pull request was exported from Phabricator. Differential Revision: D45431372 |
Summary: Pull Request resolved: facebook#37305 ### Stack ARIA roles in React Native are implemented on top of `accessibilityRole`. This is lossy because there are many more ARIA roles than `accessibilityRole`. This is especially true for RN on desktop where `accessibilityRole` was designed around accessibility APIs only available on mobile. This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing `accessibilityRole`. This gives the platform more control in exactly how to map an ARIA role to native behavior. As an example, this would allow mapping any ARIA role to [`AutomationControlType`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.peers.automationcontroltype?view=windowsdesktop-7.0&viewFallbackFrom=dotnet-uwp-10.0) on Windows without needing to fork to add new options to `accessibilityRole`. It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native). ### Diff This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs. 1. `Role` enum for the View `role` prop (ARIA role) 2. Sync enums and conversions to JS `AccessibilityRole` 1. This parsing is done for `TextAttributes` only. `View` uses the string directly 2. Add ARIA roles, and parse those to their enum form. 3. Move enums from attributedstring primitves to accessibility primitives 3. Add to viewconfig to allow it to be passed Changelog: [Internal] Differential Revision: D45431372 fbshipit-source-id: eac9d882cc8287741bf3c3d3ca1f1a126515c302
e5d95b3
to
ed73dab
Compare
This pull request was exported from Phabricator. Differential Revision: D45431372 |
Summary: Pull Request resolved: facebook#37305 ### Stack ARIA roles in React Native are implemented on top of `accessibilityRole`. This is lossy because there are many more ARIA roles than `accessibilityRole`. This is especially true for RN on desktop where `accessibilityRole` was designed around accessibility APIs only available on mobile. This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing `accessibilityRole`. This gives the platform more control in exactly how to map an ARIA role to native behavior. As an example, this would allow mapping any ARIA role to [`AutomationControlType`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.peers.automationcontroltype?view=windowsdesktop-7.0&viewFallbackFrom=dotnet-uwp-10.0) on Windows without needing to fork to add new options to `accessibilityRole`. It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native). ### Diff This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs. 1. `Role` enum for the View `role` prop (ARIA role) 2. Sync enums and conversions to JS `AccessibilityRole` 1. This parsing is done for `TextAttributes` only. `View` uses the string directly 2. Add ARIA roles, and parse those to their enum form. 3. Move enums from attributedstring primitves to accessibility primitives 3. Add to viewconfig to allow it to be passed Changelog: [Internal] Differential Revision: D45431372 fbshipit-source-id: 21a5df082c3b0a202994f150e9eafe4619b4da7b
ed73dab
to
73f3887
Compare
This pull request was exported from Phabricator. Differential Revision: D45431372 |
Summary: Pull Request resolved: facebook#37305 ### Stack ARIA roles in React Native are implemented on top of `accessibilityRole`. This is lossy because there are many more ARIA roles than `accessibilityRole`. This is especially true for RN on desktop where `accessibilityRole` was designed around accessibility APIs only available on mobile. This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing `accessibilityRole`. This gives the platform more control in exactly how to map an ARIA role to native behavior. As an example, this would allow mapping any ARIA role to [`AutomationControlType`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.peers.automationcontroltype?view=windowsdesktop-7.0&viewFallbackFrom=dotnet-uwp-10.0) on Windows without needing to fork to add new options to `accessibilityRole`. It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native). ### Diff This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs. 1. `Role` enum for the View `role` prop (ARIA role) 2. Sync enums and conversions to JS `AccessibilityRole` 1. This parsing is done for `TextAttributes` only. `View` uses the string directly 2. Add ARIA roles, and parse those to their enum form. 3. Move enums from attributedstring primitves to accessibility primitives 3. Add to viewconfig to allow it to be passed Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D45431372 fbshipit-source-id: 15783e6521e2b6d8a10eb2fceb514bfcb5b26f27
73f3887
to
114607f
Compare
This pull request was exported from Phabricator. Differential Revision: D45431372 |
Summary: Pull Request resolved: facebook#37305 ### Stack ARIA roles in React Native are implemented on top of `accessibilityRole`. This is lossy because there are many more ARIA roles than `accessibilityRole`. This is especially true for RN on desktop where `accessibilityRole` was designed around accessibility APIs only available on mobile. This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing `accessibilityRole`. This gives the platform more control in exactly how to map an ARIA role to native behavior. As an example, this would allow mapping any ARIA role to [`AutomationControlType`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.peers.automationcontroltype?view=windowsdesktop-7.0&viewFallbackFrom=dotnet-uwp-10.0) on Windows without needing to fork to add new options to `accessibilityRole`. It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native). ### Diff This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs. 1. `Role` enum for the View `role` prop (ARIA role) 2. Sync enums and conversions to JS `AccessibilityRole` 1. This parsing is done for `TextAttributes` only. `View` uses the string directly 2. Add ARIA roles, and parse those to their enum form. 3. Move enums from attributedstring primitves to accessibility primitives 3. Add to viewconfig to allow it to be passed Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D45431372 fbshipit-source-id: f0f02101fa573da475c0e7b084172557a8780bd8
114607f
to
6310477
Compare
This pull request was exported from Phabricator. Differential Revision: D45431372 |
This pull request has been merged in 9db5fa2. |
Summary:
Stack
ARIA roles in React Native are implemented on top of accessibilityRole. This is lossy because there are many more ARIA roles than accessibilityRole. This is especially true for RN on desktop where accessibilityRole was designed around accessibility APIs only available on mobile.
This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing accessibilityRole. This gives the platform more control in exactly how to map an ARIA role to native behavior.
As an example, this would allow mapping any ARIA role to AutomationControlType on Windows without needing to fork to add new options to accessibilityRole.
It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native).
Diff
This syncs the Fabric representations of Roles to the current state of the world in JS, and adds usage to the view configs.
Role
enum for the Viewrole
prop (ARIA role)AccessibilityRole
TextAttributes
only.View
uses the string directlyChangelog: [Internal]
Differential Revision: D45431372