-
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
Fix/30842 - Add accessibilityState prop in slider #31145
Conversation
Hi @sladyn98! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Do I need to add a test to this PR and I would like to know how I can manually test this PR thanks using Talkback. Thanks |
Base commit: e6dc371 |
Base commit: e6dc371 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you @sladyn98 for opening this PR! RN-tester is preferred for testing https://github.com/facebook/react-native/tree/master/packages/rn-tester, it makes it easier to review PRs and is helpful for reviewers. @fabriziobertoglio1987 Yes please include examples! |
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.
Thanks for putting this together @sladyn98! As was mentioned in the comments, can we add an example to RNTester with the accessibility examples? Also, were you able to test this on both iOS and Android? I can help test either platform if you don't have access to one
@@ -197,6 +204,7 @@ const Slider = ( | |||
forwardedRef?: ?React.Ref<typeof SliderNativeComponent>, | |||
) => { | |||
const style = StyleSheet.compose(styles.slider, props.style); | |||
const accessibilityState = props.accessibilityState || {}; |
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 for accessibilityState
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 empty
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.
Yea we can directly pass the prop to the native component.
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.
Requesting changes as from my comment
@sladyn98 Let me know if you have any questions or change in plans to working on this |
}}> | ||
<Text>Slider</Text> | ||
</View> | ||
</RNTesterBlock> |
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.
This is my first time trying to add a test/example, woud I need to set the accessibilityState={{disabled: true}}
as initially ? and how would i set it later on like when the slider is used should I alert that the state has changed
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.
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 comment
The 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 comment
The 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 comment
The 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 comment
The 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:
<Slider
maximumValue={maximumValue}
minimumValue={minimumValue}
onSlidingComplete={onSlidingComplete}
value={value}
accessibilityState={{disabled: true}} // or whatever accessibilityState you'd want to pass
/>
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops sorry about the delay, forgot to hit submit!
@sladyn98 Are you planning to flesh out the example? If not, we can take this in as is and I can help flesh out the example for Slider. Let me know what you want to do! |
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@lunaleaps merged this pull request in 35dd861. |
@lunaleaps Yeah I am not sure how to add the example so if you could that would be great |
Summary
Accessibility service does not announce "selected" on accessibilityState = {selected: true} of the Button Component.
Issue link - #30956
Changelog
[General] [Added] - Add accessibilityState prop to Slider component
Test Plan
Need to create a slider example and tested it on VoiceOver and Talkback