-
Notifications
You must be signed in to change notification settings - Fork 146
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
Enabling AccessibilityInfo.setAccessibilityFocus for MacOS #450
Enabling AccessibilityInfo.setAccessibilityFocus for MacOS #450
Conversation
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.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.
@@ -54,6 +54,14 @@ - (void)dealloc | |||
callback(@[ @(isVoiceOverEnabled) ]); | |||
} | |||
|
|||
RCT_EXPORT_METHOD(setAccessibilityFocus:(nonnull NSNumber *)reactTag) | |||
{ | |||
dispatch_async(dispatch_get_main_queue(), ^{ |
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 we use RCTExecuteOnMainQueue
here?
dispatch_async(dispatch_get_main_queue(), ^{ | |
RCTExecuteOnMainQueue(^{ |
(You might have to also add #import "RCTUtils.h"
on top.)
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.
It is consistent with the iOS implementation that just calls dispatch_async on main queue. The RCTExecuteOnMainQueue does the same thing, but checks if already on the main queue and if so just calls the block. In this case it will always be called on the JS thread.
@@ -570,6 +570,26 @@ class AnnounceForAccessibility extends React.Component<{}> { | |||
} | |||
} | |||
|
|||
class SetAccessibilityFocus extends React.Component<{}> { |
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.
Did you create a PR upstream for this?
Please select one of the following
Summary
When the MacOS fork was made all the AccessibilityInfo functionality was stubbed out because the iOS Accessibility APIs are different from the MacOS APIs. I've filled back out the functionality for setAccessibilityFocus.
Changelog
[MacOS] [Added] - Implemented AccessibilityInfo.setAccessibilityFocus
Test Plan
Microsoft Reviewers: Open in CodeFlow