-
Notifications
You must be signed in to change notification settings - Fork 11
fix: android-headless-talkback-accessibility #19
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
9a28278
17f4099
cb7cd29
8be9c8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,7 @@ export default class RNPickerSelect extends PureComponent { | |
| this.scrollToInput = this.scrollToInput.bind(this); | ||
| this.togglePicker = this.togglePicker.bind(this); | ||
| this.renderInputAccessoryView = this.renderInputAccessoryView.bind(this); | ||
| this.androidPickerRef = React.createRef(); | ||
| } | ||
|
|
||
| componentDidUpdate = (prevProps, prevState) => { | ||
|
|
@@ -579,16 +580,41 @@ export default class RNPickerSelect extends PureComponent { | |
| const { selectedItem } = this.state; | ||
|
|
||
| const Component = fixAndroidTouchableBug ? View : TouchableOpacity; | ||
| const pickerRef = (pickerProps && pickerProps.ref) || this.androidPickerRef; | ||
|
|
||
| const handleAccessibilityAction = (event) => { | ||
| if (disabled) { | ||
| return; | ||
| } | ||
| if (event.nativeEvent.actionName === 'activate') { | ||
| if (pickerRef && pickerRef.current && pickerRef.current.focus) { | ||
| pickerRef.current.focus(); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| const accessibilityLabel = selectedItem.inputLabel || selectedItem.label; | ||
|
|
||
| return ( | ||
| <Component | ||
| testID="android_touchable_wrapper" | ||
| onPress={onOpen} | ||
| activeOpacity={1} | ||
| {...touchableWrapperProps} | ||
| accessible | ||
| accessibilityRole="combobox" | ||
| accessibilityLabel={accessibilityLabel} | ||
| accessibilityState={{ disabled }} | ||
| onAccessibilityAction={handleAccessibilityAction} | ||
| accessibilityActions={[{ name: 'activate' }]} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add support for 'escape' action too?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The iOS does not have this functionality, so adding for Android would make it inconsistent IMO. But if it's need we can do a separate follow-up PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TaduJR, it's the other way around, iOS does support it, Android doesn't. Let's add it here
But that still stands true, how do we close the picker on Android? Is it the 'collapse' action? |
||
| > | ||
| <View style={style.headlessAndroidContainer}> | ||
| <View | ||
| style={style.headlessAndroidContainer} | ||
| importantForAccessibility="no-hide-descendants" | ||
| > | ||
| {this.renderTextInputOrChildren()} | ||
| <Picker | ||
| ref={pickerRef} | ||
| style={[ | ||
| Icon ? { backgroundColor: 'transparent' } : {}, // to hide native icon | ||
| defaultStyles.headlessAndroidPicker, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.