-
Notifications
You must be signed in to change notification settings - Fork 726
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
TabBar - Better accessibility roles and instructions #3501
base: master
Are you sure you want to change the base?
Conversation
…ring React Native upgrade
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.
Not sure why but it's not working for me
@@ -226,6 +226,9 @@ export default function TabBarItem({ | |||
style={_style} | |||
onLayout={onLayout} | |||
testID={testID} | |||
accessible | |||
accessibilityRole="tab" | |||
accessibilityState={{selected: selectedIndex === index}} |
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 you can use currentPage.value
to remove most of the code in the PR
accessibilityState={{selected: selectedIndex === index}} | |
accessibilityState={{selected: currentPage.value === index}} |
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.
Unfortunately this doesn't work because the value doesn't change with the javascript :/
Did it work for you?
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.
Maybe it's the re-selection, I'll re-test
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.
@nitzanyiz lets try to do what you've suggested (use useAnimatedReaction
) instead of the context
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.
Changed. I added useAnimatedReaction
in the TabBarItem
that will change its state only when it becomes selected or unselected.
Did you try on a real device? It not working in the inspector but does on a real device. |
Yes, I've tested on a real device withe the public demo |
…e and updating accessibilityState logic
@M-i-k-e-l I changed the state to be controlled in the |
Description
tab
accessibility role to the tab items andtablist
role to the tab controller.We can give each tab item an isSelected state and change it accordingly so a state change will only effect the specific TabItem instead of handling it in the context scope and passing it down. wdyt?
Changelog
TabBar - Added better accessibility roles.
Additional info
MADS-4590