fix(android): clear focus and hide the keyboard when leaving a page - #1155
Open
KisaneNeko wants to merge 1 commit into
Open
KisaneNeko wants to merge 1 commit into
KisaneNeko wants to merge 1 commit into
Conversation
KisaneNeko
marked this pull request as ready for review
October 2, 2026 07:35
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
Fixes #1154. Reported in Expensify/App#101157 after bumping from 8.0.0 to 9.0.4.
On Android, a focused
TextInputkeeps focus after its page is left withsetPageor a swipe. The keyboard stays open with nothing focused on screen, and typing still goes into the input on the page you just left.reproduction
1154-before-9.0.6.mp4
1154-after-fix.mp4
What happened
HorizontalPager. It doesn't touch focus, and neighbouring pages stay attached, so the input keeps both focus and the keyboard.Fix
When a page is selected,
ComposePagerViewnow clears focus held outside that page, and hides the keyboard if it was attached to the input that lost focus.setPage(while the pager is still animating) keeps it. ViewPager2 cleared that one too.onPageSelected, the keyboard hides and then shows again.Test Plan
What's required for testing (prerequisites)?
Android emulator or device. A pager with a
TextInputon at least two pages.What are the steps to reproduce (after prerequisites)?
Added
Issue #1154 Page Change Focus Reproto the example app and.maestro/android-only/issue_1154_page_change_focus_repro.yaml:Go 1and focus the input on page 1.Go 0, or swipe to another page.onSelected/onPressbuttons focus the new page's input fromonPageSelectedor right aftersetPage. Both still end with that input focused.Verified
typescript,lint(no new warnings) andtestpass, plus the Android unit tests.issue_1096_keyboard_shrink_reprofails the same way without the fix (the keyboard covers the row it taps).pager_vertical_basic_exampleandissue_1083_modal_set_page_reprofailed on the first run and passed on a rerun, with and without the fix.iOS is untouched.
Compatibility
Checklist
README.md: not applicable