Skip to content
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

feat: Adding basic accessibility out of the box #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdityaPahilwani
Copy link

Currently, react-native-segmented-control is not accessible and neither export some props to add labels or hints on text and badges, this small PR adds very very basic accessibility out of the box.

@Karthik-B-06
Copy link
Owner

LGTM @AdityaPahilwani, and on a different note do you think we need to export the accessibility props?

@AdityaPahilwani
Copy link
Author

Yes that could be a nice addition.

I was thinking of adding 2 props for accessible
segmentAccessibilityLabel: Array of strings representing accessibilityLabel for segments
segmentAccessibilityHint: Array of strings representing accessibilityHint or segments

do you think equivalent of accessibilityrole, accessibilityState would make sense?

@Karthik-B-06
Copy link
Owner

Karthik-B-06 commented Jan 17, 2022

Too many props as an array would make it odd as for the component. Need to think of a better way to get this done, I guess. I feel there are already too many props. If there isn't a way. We will have to create separate props for the same. Do you think changing the segments array into an array of objects would simplify this?

image

@AdityaPahilwani
Copy link
Author

initially, I thought about the same but changing the segments array into an array of objects would be a breaking change and for someone who isn't using accessibility keys, it would be a little more effort to put the component working.

I think we can go with a mixed approach like either user pass array of labels or array of object, this way we can be backward compatible and give user control on what they want.

@Karthik-B-06
Copy link
Owner

Sounds good to me!

@AdityaPahilwani
Copy link
Author

I think we should have support for all these in objects, also I would love to pick this task.
accessibilitylabel
accessibilityhint
accessibilityRole
accessibilityState

@Karthik-B-06
Copy link
Owner

Great @AdityaPahilwani! Will wait for your PR :) Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants