Repository navigation
fix(android): clear focus and hide the keyboard when leaving a page - #1155
Merged
Merged
Conversation
troZee
reviewed
Oct 7, 2026
| @@ -0,0 +1,80 @@ | |||
| appId: com.pagerviewexample | |||
Collaborator
There was a problem hiding this comment.
Please rebase your branch and migrate it to e2e
Contributor
Author
There was a problem hiding this comment.
e2e migration done, looking into resolving conflicts and this should be ready to re-review
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused Android fix is consistent with the stated behavior and has comprehensive regression coverage.
0 open findings
What changed in this PR
Fixes Android focus retention when leaving a pager page.
Changes:
- Clears focus outside the selected page and hides its keyboard.
- Adds a dedicated reproduction screen.
- Adds Android Maestro regression coverage.
| File | Description |
|---|---|
ComposePagerView.kt |
Implements focus and keyboard cleanup. |
Issue1154PageChangeFocusRepro.tsx |
Adds the reproduction screen. |
App.tsx |
Registers the example. |
| Maestro setup YAML | Opens the reproduction screen. |
| Maestro Android YAML | Tests paging and focus scenarios. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
troZee
requested changes
Oct 7, 2026
KisaneNeko
force-pushed
the
fix/android-page-change-focus
branch
from
October 9, 2026 06:22
de4a4f3 to
8fe1ce0
Compare
KisaneNeko
force-pushed
the
fix/android-page-change-focus
branch
from
October 9, 2026 08:28
8fe1ce0 to
9ffc841
Compare
troZee
approved these changes
Oct 9, 2026
troZee
enabled auto-merge (squash)
October 9, 2026 08:53
auto-merge was automatically disabled
October 9, 2026 09:13
Head branch was pushed to by a user without write access
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
expensify-local-unfixed.mp4
expensify-local-fixed.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 ande2e/tests/issues/issue-1154-page-change-focus.e2e.ts: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(root and example),lint(no new warnings) andtestpass, prettier is clean, plus the Android unit tests.iOS is untouched.
Compatibility
Checklist
README.md: not applicable