-
Notifications
You must be signed in to change notification settings - Fork 571
Accessibility for action buttons. #308
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
base: master
Are you sure you want to change the base?
Accessibility for action buttons. #308
Conversation
…action button is active and the platform is ios. Focuses on top button when action button is active.
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.
Love this. Thanks a lot. I am in need of this for a project too ❤️ 😍
I'm added a few comments on improvements that I would make
} | ||
const reactTag = findNodeHandle(ref); | ||
|
||
Platform.OS === 'android' ? UIManager.sendAccessibilityEvent( |
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.
You could use the isAndroid
-method witch is imported on line line 19 instead of this
|
||
const focusOnView = (ref) => { | ||
if (!ref) { | ||
console.warn('ref is null'); |
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.
If this console.warn
should stay, witch I think it could. I think that the error message should be better then this.
this.state = { | ||
resetToken: props.resetToken, | ||
active: props.active | ||
active: props.active, |
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 I'm on #teamtrailingcomma ❤️
} = this.props; | ||
|
||
if (nextProps.resetToken !== resetToken) { | ||
if (nextProps.active === false && active === true) { |
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.
Nitpick:
The === true
and === false
is redundant.
if (nextProps.active === false && active === true) { | |
if (!nextProps.active && active) { |
Also, personally i'm not a fan of nested if statements
return `${acc} ${actionButton.props.accessibilityLabel}, `; | ||
}, announceActionsLabel); | ||
|
||
if (actionButtons.length && Platform.OS === 'ios') { |
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.
Nitpick:
Maybe you should add an isIOS
-method to shared.js
, that checks the that Platform.OS === 'ios'
, and use is here
Announces action button items when action button is active and the platform is ios. Focuses on top button when action button is active.