Repository navigation
fix(mobile): activate focused pressables from hardware keys - #1966
Conversation
|
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. |
58ff896 to
16383bd
Compare
16383bd to
a461c87
Compare
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
Focusableviews, 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 2passed.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.TestMobileModifiedKeyboardActivationpassed 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.Only Java source is included. Locally generated Android runtime binaries were restored before commit; CI owns their rebuild.