react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.53k stars 289 forks source link

fix(#310): missing a11y label and hint props on iOS Picker #582

Closed mateusz1913 closed 2 months ago

mateusz1913 commented 2 months ago

This PR adds missing accessibilityLabel and accessibilityHint props on iOS Picker component. The solution uses UIPickerViewAccessibilityDelegate which uses values from accessibilityLabel and accessibilityHint JS props.

closes #310

Attaching two recordings, one before fix and one after fix. By default VoiceOver announces the text of selected picker item, then it announces "picker item", then it announces "adjustable" accessibilityRole, then it announces item's position in collection, e.g. 1 of 3. After that it announces default hint for swiping picker up or down to change selected item. After fix, Voiceover will first announce the accessibilityLabel value, then the text of selected picker item, then it announces "picker item", then it announces "adjustable" accessibilityRole, then it announces item's position in collection, e.g. 1 of 3. After that it announces the accessibilityHint value followed by default hint for swiping picker up or down to change selected item.

Before:

https://github.com/user-attachments/assets/b3bca205-5bd8-456f-b46f-782df7dcce86

After:

https://github.com/user-attachments/assets/a7717f95-7877-418e-8c81-a6dd044075fd

Naturalclar commented 2 months ago

:tada: This PR is included in version 2.8.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: