-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Toggle Button accessibilityRole
Summary: Changelog: [General][Added] Add support for "togglebutton" accessibilityRole # Context The role for ToggleButton, which is needed on Android to implement toggle buttons correctly, is not currently supported. # What does this diff do? Adds support for accessibilityRole `"togglebutton"`. On Android, this maps to class `"Android.widget.ToggleButton"`. iOS does not have an equivalent trait for togglebutton, so I set it to be the same as setting `accessibilityRole="button"` for iOS. # Caveats - checked vs selected It seems to me like this role currently requires that you set `accessibilityState={{checked: true/false}}`. The behavior is strange when setting `selected` state, I think because on Android ToggleButtons are meant to use `checked` to indicate toggled on/off. This is tricky because typically on iOS if you have a toggle button, you would use `selected` instead of `checked`, so RN users are likely to mess this up. Possible solutions: 1. document that you should use `checked` state on Android for toggle buttons (and maybe throw a warning if someone passes in `selected`). 2. have RN ignore it if someone passes in accessibilityState `selected`, if this role is used. 3. Have RN convert passed in `selected` state to `checked` on the Android side. Reviewed By: nadiia Differential Revision: D27976046 fbshipit-source-id: 4ce202449cf2371f4bf83c4db2d53120369ee7b0
- Loading branch information
1 parent
ab66741
commit da899c0
Showing
6 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters