diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 0dd52234048f..6e20d03f6438 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -1762,7 +1762,9 @@ - (void)focus - (void)blur { - [[self window] resignFirstResponder]; + if ([[self window] firstResponder] == self) { + [[self window] makeFirstResponder:nil]; + } } - (BOOL)needsPanelToBecomeKey diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm index 20f44da228d1..0a81e6391571 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm @@ -171,6 +171,18 @@ - (NSArray *)accessibilityChildren [self _unhideIfNeeded]; return [super accessibilityChildren]; } + +- (BOOL)acceptsFirstResponder +{ + [self _unhideIfNeeded]; + return [super acceptsFirstResponder]; +} + +- (id)accessibilityHitTest:(NSPoint)point +{ + [self _unhideIfNeeded]; + return [super accessibilityHitTest:point]; +} #endif // macOS] - (void)prepareForRecycle diff --git a/packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm b/packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm index 9f5114766e72..506768a6c1b5 100644 --- a/packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm +++ b/packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm @@ -346,7 +346,12 @@ - (void)synchronouslyDispatchAccessbilityEventOnUIThread:(ReactTag)reactTag even RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS] #if !TARGET_OS_OSX // [macOS] UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, componentView); -#endif // [macOS] +#else // [macOS + if (componentView != nil) { + [[componentView window] makeFirstResponder:componentView]; + NSAccessibilityPostNotification(componentView, NSAccessibilityFocusedUIElementChangedNotification); + } +#endif // macOS] } }