Skip to content

fix(mobile): activate focused pressables from hardware keys - #1966

Merged
houko merged 1 commit into
mainfrom
fix/mobile-key-activation-1350
Nov 22, 2026
Merged

houko merged 1 commit into
mainfrom
fix/mobile-key-activation-1350

Conversation

@houko

@houko houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Focused pressables on Android and iOS could not receive physical Space/Return activation with their modifiers. Android only handled native key dispatch for text fields, while iOS/iPad focus was limited to tvOS and phone key handling had no pressable activation path.

This adds explicit native focus for enabled pressables and Focusable views, keeps touch focus behavior unchanged, and activates focused pressables after the keymap with modifier-preserving press phases. Android handles modal scope, disabled/hidden/NoFocus guards, native focus reports and key release consumption. iOS/iPad use a non-editing first responder; tvOS keeps its remote select lifecycle and now shares the activation helper. Native editors retain their editing path.

Adds mobile test-host regressions covering 12 Space/Return chords, all four modifiers, keymap precedence, checkbox callbacks, focus guards, modal scope and native text editing. Adds an Apple TV remote lifecycle fixture.

Closes #1350.

Verification

  • go tool nsgo check -target ios,ios_simulator,tvos,android -jobs 2 passed.
  • go tool nsgo test ./base: 470 passed, 2 skipped.
  • go tool nsgo test ./nsgotest: 162 passed, 1 skipped.
  • go tool nsgo test ./internal/platform/android: 52 passed, 6 native-only skipped.
  • go tool nsgo test ./internal/platform/ios: 14 passed.
  • go tool nsgo test ./internal/moduletest: 12 passed.
  • Native TestMobileModifiedKeyboardActivation passed on an iPhone 16 / iOS 18.4 simulator and API 35 Android emulator. These runs used native focus reports rather than headless model focus and verified all 12 chords.
  • The tvOS runtime and device were created on the isolated remote simulator, but its CoreSimulator service remained unavailable while the tvOS test build was downloading dependencies. The Apple TV fixture is included and the pending run is documented; no shared device was used.

Only Java source is included. Locally generated Android runtime binaries were restored before commit; CI owns their rebuild.

@github-actions github-actions Bot added size/L bug Something isn't working documentation Improvements or additions to documentation iOS Android core base and removed bug Something isn't working size/L labels Nov 22, 2026
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 22, 2026
@houko

houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. Checked the Android path (Focusable/NoFocus flags written and read at the same bit positions, activation after the keymap with repeats and the matching release consumed, focus dropped when a stop becomes hidden, disabled or covered by a modal) and the iOS path (a plain NsgoView becomes first responder only when focusable and not on tvOS, no duplicate selectors on the class, tvOS remote select kept separate). FocusesViews is used only by nsgotest, so the wider definition changes nothing else in core. Rebased by hand over main's physical-key reporting (dispatchKeyEvent now calls physicalKey, then keyBinding, activateKey and super; window blur releases both sets), nsgotest's KindInput rename and the docs/roadmap rows. Unwrapped the new hard-wrapped comments. Linux: go test ./nsgotest ./base ./internal/driver and the Android package with a real JDK pass; iOS vet passes with and without nsgotest.

@houko
houko force-pushed the fix/mobile-key-activation-1350 branch from 58ff896 to 16383bd Compare November 22, 2026 14:59
@github-actions github-actions Bot added size/L bug Something isn't working labels Nov 22, 2026
@houko
houko force-pushed the fix/mobile-key-activation-1350 branch from 16383bd to a461c87 Compare November 22, 2026 14:59
@houko
houko merged commit c091fc0 into main Nov 22, 2026
14 of 17 checks passed
@houko
houko deleted the fix/mobile-key-activation-1350 branch November 22, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android base bug Something isn't working conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation iOS size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard: Modified keyboard activation on mobile

1 participant