-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Accessibility] Expose the implementation for setting accessibility focus programmatically on iOS. Also, expose .focus() API for RX.Button. #90
Conversation
@eulphean, |
src/ios/AccessibilityUtil.ts
Outdated
@@ -15,7 +15,9 @@ import { AccessibilityPlatformUtil } from '../common/AccessibilityUtil'; | |||
|
|||
export class AccessibilityUtil extends AccessibilityPlatformUtil { | |||
setAccessibilityFocus(component: React.Component<any, any>): void { | |||
// NO-OP | |||
if (RN.AccessibilityInfo && Accessibility.isScreenReaderEnabled()) { |
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.
Should you ensure RN.AccessibilityInfo.setAccessibilityFocus is defined, so this doens't crash on versions of RN without this API?
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 can merge these two checks
src/ios/Accessibility.ts
Outdated
@@ -63,7 +63,9 @@ export class Accessibility extends NativeAccessibility { | |||
|
|||
// Some versions of RN don't support this interface. | |||
if (RN.AccessibilityInfo) { |
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.
merge the two if blocks
src/ios/AccessibilityUtil.ts
Outdated
@@ -15,7 +15,9 @@ import { AccessibilityPlatformUtil } from '../common/AccessibilityUtil'; | |||
|
|||
export class AccessibilityUtil extends AccessibilityPlatformUtil { | |||
setAccessibilityFocus(component: React.Component<any, any>): void { | |||
// NO-OP | |||
if (RN.AccessibilityInfo && Accessibility.isScreenReaderEnabled()) { |
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 can merge these two checks
…ocus programmatically on iOS. Also, expose .focus() API for RX.Button.
…ocus programmatically on iOS. Also, expose .focus() API for RX.Button. (microsoft#90) * [Accessibility] Expose the implementation for setting accessibility focus programmatically on iOS. Also, expose .focus() API for RX.Button.
This change enables the react-native work to programmatically set accessibility focus for iOS. Since that change will take some time to be contributed back to open source React-Native, this API will not work as expected.
This change also exposes the .focus() behavior for RX.Button.