-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fix/30842 - Add accessibilityState prop in slider #31145
Changes from all commits
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 |
---|---|---|
|
@@ -20,6 +20,7 @@ const { | |
TouchableWithoutFeedback, | ||
Alert, | ||
StyleSheet, | ||
Slider, | ||
Platform, | ||
} = require('react-native'); | ||
|
||
|
@@ -605,6 +606,15 @@ class AccessibilityActionsExample extends React.Component { | |
</View> | ||
</TouchableWithoutFeedback> | ||
</RNTesterBlock> | ||
|
||
<RNTesterBlock title="Fake slider example"> | ||
<SliderNativeComponent | ||
maximumValue={maximumValue} | ||
minimumValue={minimumValue} | ||
onPress={() => Alert.alert('Alert has been moved')} | ||
/> | ||
<Text>Slider</Text> | ||
</RNTesterBlock> | ||
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. This is my first time trying to add a test/example, woud I need to set the 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. I think the original issue is that the Slider component does not announce its selection on focus. So you'd want to render a Slider component here .. I'm not sure if there's a callback for an onFocus here. But at least with Talkback/VoiceOver on we'd want to confirm that the Slider state is being announced. Not sure the best way to illustrate that in the example 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. Oh maybe I can ask @fabriziobertoglio1987 to assist us here 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. @sladyn98 Here are the docs for the Slider component 🙏 https://reactnative.dev/docs/next/slider 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. I added an example here, how do I get i set the accessibility State here ? like it does not have a property pertaining to that 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. @sladyn98 I'm not sure I understand your question. I think you want to render something like:
and then verify with TalkBack that the slider is respecting the accessibilityState passed. The one I'm most familiar with is disability but there are others: https://reactnative.dev/docs/accessibility#accessibilitystate Some of them may not make sense on the Slider component like busy/expanded but maybe you could experiment and add a comment about what is expected? 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. Whoops sorry about the delay, forgot to hit submit! |
||
</View> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be an empty object if no
props.accessibilityState
? It seems like SliderNativeComponent allows for null value foraccessibilityState
prop. In this approach you'd be a creating a non-used new object every time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was wondering too, so should we just omit the empty object since
props.accessibilityState
would return null if its emptyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea we can directly pass the prop to the native component.