Repository navigation
fix(focus): enable imperative view refs on macOS - #3171
Open
Jason Morse (JasonVMo) wants to merge 1 commit into
Open
Jason Morse (JasonVMo) wants to merge 1 commit into
Jason Morse (JasonVMo) wants to merge 1 commit into
Conversation
Keep macOS Fabric view focus and blur commands available without enabling the common feature flag on iOS or Android. Restore generator consistency and preserve TextInput command routing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33ea5c72-8bbd-448d-aa21-c9b99dd03c96
Author
|
Additional validation: the six independent main fixes (#3170–#3175) were combined at e9667492e9 in an isolated worktree. After regenerating Pods from packages/rn-tester, RNTester-macOS and RNTester for arm64/x86_64 iOS simulators both built successfully. Exact commands, corrected codegen invocation, and limitations are recorded in #3175 (integration validation comment). This is build evidence, not live UI or sanitizer qualification; no PR was merged. |
This branch has not been deployed
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:
ref.focus()andref.blur()currently do nothing on macOS with the default feature flags. The generator configuration changedenableImperativeFocustotruein c32f3fc, but its generated JavaScript, C++, and Kotlin defaults remainfalse. The generator's unchanged check consequently also fails.RCTViewComponentViewalready implements AppKit focus/blur and emits focus events without this flag. Restore the configuration's common default tofalseso all generated files stay unchanged. Simply regenerating withtruewould also enable new behavior on iOS and Android; their existing flag gates and defaults are preserved instead.TextInputStatepath. This does not change native first-responder handling or the TextInput host/key-view-loop fixes from fix(macos): Fabric accessibility roles and state, and TextInput read-only and Tab-stop fixes #3136.This belongs in the fork: it restores macOS-specific behavior without changing upstream's platform rollout. Verified against
mainat 0b569f1; no matching open PR was found forenableImperativeFocusorReactNativeElement. No Changeset is needed formain.Test Plan:
All commands ran from the worktree root using Yarn 4.12.0 and Node 24.18.0.
yarn install --immutableyarn jest packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-test.js --runInBand --watchman=false --cacheDirectory .yarn/jest-cacheyarn jest packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-test.js packages/react-native/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js --runInBand --watchman=false --cacheDirectory .yarn/jest-cacheyarn featureflags --verify-unchangedmainafter installation, identifying the three inconsistent generated defaults. Passed after this fix; no generated files changed.yarn flow focus-check packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-test.js --max-workers 2 --temp-dir .yarn/flow-cacheyarn eslint --max-warnings 0 packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-test.jsyarn exec prettier --check packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-test.jsgit --no-pager diff --checkgit --no-pager diff --cached --checkNot run: repository-wide
yarn flow-check,yarn lint,yarn format-check, the full Jest/Fantom suites, native macOS/iOS/Android builds, Pods, Metro, RNTester focus/blur interaction, or accessibility event probes/screenshots. Validation is scoped to the changed JavaScript and feature-flag generation; native AppKit behavior was inspected but not exercised in a running app. No native sources or generated files changed.