fix(macos): three Fabric focus regressions (blur, sendAccessibilityEvent, VirtualView)#2959
Closed
tvinhas wants to merge 1 commit into
Closed
fix(macos): three Fabric focus regressions (blur, sendAccessibilityEvent, VirtualView)#2959tvinhas wants to merge 1 commit into
tvinhas wants to merge 1 commit into
Conversation
…ent, VirtualView)
This was referenced May 13, 2026
Open
christopherwxyz
added a commit
to officialunofficial/react-native-macos
that referenced
this pull request
Jun 6, 2026
…crosoft#2957 microsoft#2959 microsoft#2963 microsoft#2964) Finishes the 0.83 stabilization on uno/desktop-0.85: codegen npmPackageName constant, hermes-utils static_h/main branch selection by RCT_HERMES_V1_ENABLED, three Fabric focus regressions (blur/sendAccessibilityEvent/VirtualView), React-RCTUIKit.podspec in package files, TouchableBounce focusable + AccessibilityInfo guards. RNTester-macOS unit tests remain green.
This was referenced Jul 7, 2026
Collaborator
|
closing in favor of #3015 as this authors fork is still locked and can't be updated. Original commit cherry-picked to keep credit. |
Saadnajmi
added a commit
that referenced
this pull request
Jul 8, 2026
…ent, VirtualView) (#3015) ## Summary Supersedes #2959 (the original PR's source fork is disabled, so that branch can no longer be updated). This carries the same three macOS Fabric focus/first-responder fixes forward, with @tvinhas's original commit cherry-picked to preserve authorship credit, plus one small refinement. The three regressions were surfaced while validating the "Verify focus changes" item on #2901. ### 1. `RCTViewComponentView.blur()` was a no-op `resignFirstResponder` on `NSWindow` doesn't clear the focused subview, so `ref.blur()` from JS did nothing. Now clears the first responder via `makeFirstResponder:nil`, **guarded on `self`** so it only clears focus when this view actually holds it — matching iOS `[self resignFirstResponder]` semantics and avoiding stealing focus from an unrelated view. ### 2. Fabric `setAccessibilityFocus` was a silent no-op on macOS `synchronouslyDispatchAccessbilityEventOnUIThread:` had a `#if !TARGET_OS_OSX` guard with no `#else`, so `AccessibilityInfo.setAccessibilityFocus(reactTag)` did nothing on the Fabric path. Added the macOS branch (`makeFirstResponder:` + `NSAccessibilityFocusedUIElementChangedNotification`), mirroring the old-arch path in `RCTAccessibilityManager.mm`. ### 3. `RCTVirtualViewComponentView` keyboard-nav hooks Added `acceptsFirstResponder` and `accessibilityHitTest:` to the macOS branch so keyboard/Tab and VoiceOver navigation unhide flagged-offscreen views under the `hideOffscreenVirtualViews` optimization. Partial by design (a fully `hidden=YES` view is dropped from the responder chain — full fix needs a hide-strategy redesign, tracked as follow-up). ## Difference from #2959 - Added the `if ([[self window] firstResponder] == self)` guard on `blur()` for iOS-parity / to avoid focus-stealing. - Trimmed the verbose inline comments. ## Test plan - Builds clean: RNTester-macOS (`xcodebuild -scheme RNTester-macOS -destination 'generic/platform=macOS'`) — **BUILD SUCCEEDED**. - All three changes are macOS-gated (`#if TARGET_OS_OSX` / `#else`) and preserve existing iOS/visionOS behavior. ## Credit Original work by @tvinhas in #2959 (commit cherry-picked to retain authorship). Co-authored-by: Thiago Vinhas <thiago@vinhas.net> --------- Co-authored-by: Thiago Vinhas <thiago@vinhas.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Saadnajmi
added a commit
that referenced
this pull request
Jul 8, 2026
…lityEvent, VirtualView) (#3016) ## Summary Backport of #3015 to `0.81-stable`. Three macOS-only Fabric focus / first-responder regressions: 1. **`RCTViewComponentView.blur()`** — was a no-op (`resignFirstResponder` on `NSWindow` doesn't clear the focused subview). Now clears via `makeFirstResponder:nil`, guarded on `self`. 2. **Fabric `setAccessibilityFocus`** — the macOS branch was empty; added `makeFirstResponder:` + `NSAccessibilityFocusedUIElementChangedNotification`. 3. **`RCTVirtualViewComponentView`** — added `acceptsFirstResponder` / `accessibilityHitTest:` hooks so keyboard/VoiceOver navigation unhides flagged-offscreen views. All changes are macOS-gated; iOS/visionOS behavior is unchanged. ## Test Plan Same as #3015 — builds clean (RNTester-macOS, BUILD SUCCEEDED); every change is inside a `#if TARGET_OS_OSX` / `#else` branch. ## Credit Original work by @tvinhas in #2959 (commit cherry-picked to retain authorship). Supersedes #2959. Co-authored-by: Thiago Vinhas <thiago@vinhas.net> --------- Co-authored-by: Thiago Vinhas <thiago@vinhas.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three independent focus / first-responder regressions on the macOS Fabric path, surfaced while validating the "Verify focus changes" item on the Road to 0.83 tracking issue (#2901). Each one is small, localized, and mirrors an
existing working pattern elsewhere in the codebase.
1.
RCTViewComponentView.mm—blur()calls a method that doesn't exist on NSWindowReact/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm