Fix: keep input focus by dismissing keyboard only when IOU type actually changes#94412
Conversation
Co-authored-by: thelullabyy <thelullabyy@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
@MelvinBot Please replace all Besides, let's add this test into Test and QA section Finally, open PR for ready (mark it as ready) |
|
@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-06-24.at.02.22.14.mov |
|
🤖 Done,
|
|
@jayeshmangwani Sorry but please ignore the assignment, I will review this PR |
trjExpensify
left a comment
There was a problem hiding this comment.
Same, looks good. 👍
|
@thelullabyy @MelvinBot the Author checklist is failing. |
|
The failing PR Author Checklist check is a stale older run — no code change is needed.
The red is just the older run lingering. Re-running the failed |
|
@MelvinBot I just re-ran it and it's still failing. |
|
Correcting my earlier comment — that was wrong. The green "checklist" is the PR Reviewer Checklist (a different workflow); the PR Author Checklist has genuinely never passed on this PR. Why re-running doesn't fix it: the PR Author Checklist runs on the The fix: trigger a fresh event so it re-evaluates the current body (which now has all 19 boxes checked, 0 unchecked → it will pass). Any of these works:
Editing the description (even a trivial no-op change) is the quickest. I didn't do it myself since this is the author checklist and I don't want to silently mutate your PR — but say the word and I can push an empty commit to re-trigger it. |
@MelvinBot You are using wrong PR author template. It should be this one https://raw.githubusercontent.com/Expensify/App/main/.github/PULL_REQUEST_TEMPLATE.md |
|
Good catch — I've updated the PR description to use the current |
|
@puneetlath all good now |
|
🚧 puneetlath has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|

Explanation of Change
When tracking an expense from the FAB (selecting personal space in the "To" section), every keystroke in the amount/merchant/description fields was un-focusing the input.
The root cause is in
resetIOUTypeIfChangedinsidesrc/hooks/useResetIOUType.ts.Keyboard.dismiss()was being called unconditionally at the top of the function, before the early-return guard that bails out when the IOU request type hasn't actually changed (transaction?.iouRequestType === newIOUType). Because the function runs on each render of that flow while the type is unchanged, the keyboard (and input focus) was dismissed on every input.This change reorders the logic so the early-return runs first and
Keyboard.dismiss()only fires when the IOU type is genuinely changing — which is the only case that warrants dismissing the keyboard.Fixed Issues
$ #94273
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari