fix: android - save button floats in center of the screen after edit#82536
fix: android - save button floats in center of the screen after edit#82536Julesssss merged 9 commits intoExpensify:mainfrom
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@parasharrajat 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] |
Solution deviation from initial proposalThe initial proposal introduced a simple boolean prop
No single boolean value + behavior worked across all platforms. The root cause is that each platform's keyboard utility (
This required three distinct strategies instead of two:
The platform-specific files then select the right strategy per build target:
cc @parasharrajat for context |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92886930c1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } else if (keyboardSubmitBehavior === CONST.KEYBOARD_SUBMIT_BEHAVIOR.SUBMIT_AND_DISMISS) { | ||
| KeyboardUtils.dismissKeyboardAndExecute(() => onSubmit(trimmedStringValues)); |
There was a problem hiding this comment.
Make submit-and-dismiss invoke keyboard dismissal on all platforms
The new SUBMIT_AND_DISMISS branch routes submission through KeyboardUtils.dismissKeyboardAndExecute, but the iOS (src/utils/keyboard/index.ts) and web (src/utils/keyboard/index.website.ts) implementations of that helper only run the callback and never call Keyboard.dismiss(). As a result, keyboardSubmitBehavior='submit-and-dismiss' does not actually dismiss the keyboard, so this change regresses IOURequestStepDescription from the previous always-dismiss behavior and can leave the keyboard visible when navigation is delayed or does not complete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
TLDR: The reviewer spotted that the function name suggests it dismisses the keyboard but doesn't on iOS/web — that's by design. The keyboard is dismissed by screen unmounting during navigation, which was confirmed across all platforms. Not actionable.
The concern is technically accurate but not a practical regression. Here's why:
The reviewer is correct that dismissKeyboardAndExecute on iOS native and web doesn't call Keyboard.dismiss() — it just executes the callback immediately. You can see this in the code comments themselves:
// index.ts (iOS native)
const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
// For iOS and other platforms, execute callback immediately
cb();
resolve();
};
// index.website.ts (web)
const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
// This fixes a bug specific to native apps on Android < 16
// For web it just executes callback
cb();
resolve();
};However, it's not a regression because:
- Navigation handles keyboard cleanup. When
onSubmitruns inIOURequestStepDescription, it callsNavigation.goBack()which unmounts the screen. The focused TextInput unmounts → the keyboard dismisses automatically. This is standard React Native behavior. - This was verified on all 4 platform contexts (Android native, iOS native, Android mweb Chrome, iOS mweb Safari) during testing — the keyboard always dismissed.
- The "navigation delayed or doesn't complete" edge case is not applicable here —
updateCommentinIOURequestStepDescriptioncallsgoBack()synchronously. By the time we reach the submit callback, validation has already passed (there's an early return for validation errors before the keyboard logic). - Adding
Keyboard.dismiss()back would re-introduce the bugs we just fixed — specifically the hanging button on iOS mweb Safari, which was the exact reason we moved away from the boolean approach. dismissKeyboardAndExecutewas built intentionally this way — it's an existing utility in the codebase designed specifically for the "execute immediately, let the platform handle keyboard cleanup" pattern. We're using it as intended.
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Checking this today. I was away last week. |
| if (keyboardSubmitBehavior === CONST.KEYBOARD_SUBMIT_BEHAVIOR.DISMISS_THEN_SUBMIT) { | ||
| KeyboardUtils.dismiss().then(() => onSubmit(trimmedStringValues)); | ||
| } else if (keyboardSubmitBehavior === CONST.KEYBOARD_SUBMIT_BEHAVIOR.SUBMIT_AND_DISMISS) { | ||
| KeyboardUtils.dismissKeyboardAndExecute(() => onSubmit(trimmedStringValues)); |
There was a problem hiding this comment.
Can you add a comment mentioning here that on IOS and web, this function does not actually dismiss the keyboard?
There was a problem hiding this comment.
I added a detailed comment above the keyboardSubmitBehavior prop for each behaviour:
/**
* Controls how keyboard dismissal interacts with form submission.
* - `DISMISS_THEN_SUBMIT` (default): waits for the keyboard to fully dismiss before calling `onSubmit`.
* - `SUBMIT_AND_DISMISS`: calls `onSubmit` immediately while dismissing the keyboard in parallel via `dismissKeyboardAndExecute`.
* - `SUBMIT_ONLY`: calls `onSubmit` immediately without any keyboard dismissal (navigation handles keyboard cleanup).
*/
keyboardSubmitBehavior?: ValueOf<typeof CONST.KEYBOARD_SUBMIT_BEHAVIOR>;and if somebody is curious, they can navigate to dismissKeyboardAndExecute individual functions (index.ts / index.android.ts) where there's another comment mentioning (index.ts):
// For iOS and other platforms, execute callback immediately
Additionally, the blame of my changes lead directly to this PR / issue in case more context is needed.
I think this is documented enough ✅
|
Looking into this now. |
Screenshots🔲 iOS / native🔲 iOS / Safari🔲 MacOS / Chrome🔲 Android / Chrome🔲 Android / native |
|
Checking this now... I will have updates on this in the morning. |
|
@ikevin127 Please merge main here. Its outdated. Looking for other similar pages. |
|
@MelvinBot We updated the src/pages/iou/request/step/IOURequestStepDescription.tsx component in this PR has it has floating submit button issue. Are there more pages in the app with the same issue? Do the code analsis based on how IOURequestStepDescription is designed and see if other pages are using similiar pattern. |
Analysis: Other Pages with the Same Floating Submit Button PatternI analyzed the pattern fixed in Pages vulnerable to this issue share these traits:
High-Confidence Matches (same pattern as IOURequestStepDescription)These pages have text inputs, navigate on submit, and are most likely to exhibit the floating button: IOU/Money Request Steps
Settings / Profile Pages
Chat / Room / Task Pages
Workspace Pages (selected high-impact)
There are many more workspace pages (rules amount pages, accounting integration pages, per diem pages, etc.) that follow the same pattern — roughly 50+ workspace form pages total. Reimbursement Account / Bank SubstepsThe SummaryTotal pages potentially affected: ~100+ The most visible to users would be:
RecommendationGiven the scale, it may be worth considering whether the default behavior of
This analysis was generated by MelvinBot based on code pattern analysis of the |
|
@ikevin127 Do you agree with changing the default behaviour? |
|
BUG: WEB: Enter to submit does not work. Steps:
Expected: date should submit and page should close. |
Given the number of components listed by Melvin, I think changing the behaviour at the cc @Julesssss for context - what do you think about Melvin's breakdown ?
I'll get to this sometime by the EOW next week when I'll be back at full capacity 🙏 |
|
Hmm yeah that is a lot of changes. Lets stick with the fix for the case we noticed for now.. I do think we should look into modifying the default, it's a lot of effort either way but that seems the better choice. But we can look into that separately if you are interested in that work @parasharrajat? |
|
I am happy to review that, but I won't be able to work on it currently. @Julesssss |
|
Moving ahead with fix for this page. |
Screenshots🔲 iOS / native🔲 iOS / Safari🔲 MacOS / Chrome🔲 Android / Chrome🔲 Android / native |
|
🔄 Merged main as this was about 2k commits behind even though it had no conflicts.
@parasharrajat Do you mind on confirming that this BUG does not exist on staging ? Asking because the web version of the I wasn't able to reproduce on my machine at all, but I see the part of the logic that could cause this ( The two versions (before and after my change) might look similar because they both return a Here's how the previous version - synchronous - (untouched by this PR): const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
return new Promise((resolve) => {
// This fixes a bug specific to native apps on Android < 16
// For web it just executes callback
// https://github.com/Expensify/App/issues/70692
cb();
resolve();
});
};How it works: In JavaScript, the "executor" function passed to new Promise runs synchronously. and the slight change added by me - asynchronous / microtask - in hopes it would address the BUG you found: const dismissKeyboardAndExecute = (cb: () => void): Promise<void> => {
// This fixes a bug specific to native apps on Android < 16
// For web it just executes callback
// https://github.com/Expensify/App/issues/70692
return Promise.resolve().then(cb);
};How it works: When we use
@parasharrajat Let me know if this fixes the issue on your side (since I wasn't able to reproduce it on my side). |
This comment was marked as resolved.
This comment was marked as resolved.
|
@parasharrajat 🟢 Merged main once again, resolved conflicts and all checks are passing. |
|
Thanks. |
|
Let me check it again. |
|
I tried a few different times , and I don't see that button sliding down while the page is being closed. So this approach is probably not working. 15.03.2026_19.50.47_REC.mp4 |
|
@parasharrajat I don't remember the requirement of From my context, the idea was to not delay the button until the keyboard is closed, which on Android was leaving the button stuck mid-screen while keyboard was closed, then the screen would be dismissed. This PRs change removes such delays and dismisses the screen (slides to right) at the same time with the keyboard (slides down). The video above fulfils this which makes it expected behaviour IMO. @Julesssss For context, please let us know what you think about this 🙌 |
|
Yeah, we didn't discuss that specifically, but I thought that this PR will work that way.
For this, PR is working fine. Yeah, let's confirm with Jules here. |
I also thought that, but seeing it in action I think it looks good when closing the page 👍 |
Screenshots🔲 iOS / native18.03.2026_15.36.37_REC.mp4🔲 iOS / Safari18.03.2026_15.38.41_REC.mp4🔲 MacOS / Chrome18.03.2026_09.00.39_REC.mp4🔲 Android / native18.03.2026_08.58.54_REC.mp4 |
parasharrajat
left a comment
There was a problem hiding this comment.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
- I verified tests pass on all platforms & I tested again on:
- Android: HybridApp
- Android: mWeb Chrome
- iOS: HybridApp
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick). - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text shown in the product is localized by adding it to
src/languages/*files and using the translation method - I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
- I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */ - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor) - Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If any new file was added I verified that:
- The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- If a new page is added, I verified it's using the
ScrollViewcomponent to make it scrollable when more elements are added to the page. - For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
- If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
🎀 👀 🎀 C+ reviewed
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.41-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|
Explanation of Change
FormProvidercurrently gates form submission behindKeyboardUtils.dismiss().then(() => onSubmit(...)), which on Android waits for thekeyboardDidHideevent before callingonSubmit. Combined withKeyboardAvoidingViewremoving its keyboard offset once the keyboard is considered hidden, this creates a brief window where the Save button has lost its keyboard offset but the screen hasn't navigated away yet, making it float in the center of the screen.This PR adds a new optional prop
shouldDismissKeyboardBeforeSubmittoFormProvider(defaulting totrueto preserve all existing behavior). When set tofalse,onSubmitfires immediately while keyboard dismissal happens in parallel.IOURequestStepDescriptionpassesshouldDismissKeyboardBeforeSubmit={false}so the navigation transition and keyboard animation happen simultaneously instead of sequentially.Fixed Issues
$ #72507
PROPOSAL: #72507 (comment)
Tests
Offline tests
Same as tests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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.mp4
Android: mWeb Chrome
android-mweb.mp4
iOS: Native
ios.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-16.at.14.44.08.mov