Implement keep-focus-on-submit on Android and report focus state for press dispatch - #53
Open
gwleuverink wants to merge 2 commits into
Open
Implement keep-focus-on-submit on Android and report focus state for press dispatch#53gwleuverink wants to merge 2 commits into
gwleuverink wants to merge 2 commits into
Conversation
… on submit by default
…onor keep-focus-on-submit
gwleuverink
marked this pull request as ready for review
August 18, 2026 10:16
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.
Companion to NativePHP/mobile-air#353, the input-renderer half of the keyboard-dismissal fix for NativePHP/mobile-air#335. The full story and behaviour matrix live there.
The reproduced problem was a chat composer losing the keyboard on every button send. The direction is symmetry: both platforms drop the keyboard on submit and on taps outside the field, keep-focus-on-submit is the one opt-out, and it has to actually work everywhere. iOS defaults were already right. Android's were not, and the attribute did nothing there.
On Android, the renderers never parsed keep_focus_on_submit, and supplying KeyboardActions had silently replaced Compose's default hide-on-Done, which is why Android kept the keyboard on submit while the docs said otherwise. The prop is now parsed, and submit clears focus by default and keeps it with the attribute, in all three input variants.
On both platforms the inputs now report their focus state and keep-focus flag to mobile-air's KeyboardFocusPolicy, which press dispatch consults to decide whether a button tap dismisses. The iOS input also registers a flush hook so a press can push the field's latest text, including a tap-committed autocorrection, to PHP before the press event lands.
This PR carries the Android behavioural change: submit and button taps start dropping the keyboard by default. Existing code keeps running, chat-style screens add keep-focus-on-submit to keep the old feel.
It also references KeyboardFocusPolicy, which ships in the mobile-air companion, so the composer constraint on nativephp/mobile needs to require the release that includes it. Left untouched pending the release plan.