[$175] Android - Rules - Create agent and Save buttons are hidden behind the keyboard
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.54-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/106203 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Samsung Galaxy S21/Android 15 App Component: Other
Action Performed:
- Launch Expensify app
- Log in with valid credentials
- Go to Settings > Agents > New agent > Build custom agent.
- Tap the instructions box.
- Return to Settings > Agents > In the agent, tap Copilot into account.
- Go to Settings > Profile > AI prompt > Edit prompt.
- Tap the prompt.
Expected Result:
The form slides up smoothly when the keyboard opens, without jumping. The Create agent and Save buttons remain visible above the keyboard.
Actual Result:
The keyboard hides the Create agent and Save buttons.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/8c278be1-d8a6-4a34-ac41-f1e8184f6567
Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7324321
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022125659344538711213
- Upwork Job ID: 2125659344538711213
- Last Price Increase: 2026-11-25
Issue Owner
Current Issue Owner: @jasperhuangg
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/84a7d0a147932ff2302a5e45633ea3afa82ee35aae0f4a19acbc55ef1755c77b
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)
Job added to Upwork: https://www.upwork.com/jobs/~022125659344538711213
🤖 Web test steps verification results: ⚠️ partial
Web was signed in, but Agents was unavailable, blocking both editor flows. Browser testing cannot verify Android-native keyboard overlap.
| Step | Status |
|---|---|
Launch Expensify webHome displayed. |
✅ |
Sign inExisting session was authenticated; login itself was not exercised. |
✅ |
Open Build custom agentBlocked: no Agents entry appeared.![]() |
❌ |
Focus instructions; check Create agentBlocked: editor inaccessible. |
❌ |
Copilot into an agent accountBlocked: Agents unavailable. |
❌ |
Open Profile AI prompt editorBlocked: agent account inaccessible. |
❌ |
Focus prompt; check SaveBlocked: editor inaccessible. Android keyboard behavior remains unverified. |
❌ |
Proposal
What is the root cause of that problem?
Likely cause — medium confidence, code evidence only: Android does not execute the explicit scroll request used by these instruction editors. Their buttons appear after the input within scrollable content, so revealing the focused input does not necessarily reveal Create agent or Save.
Supporting code and alternative explanations
- The Android/default
scrollToMultilineInputimplementation:1–7 deliberately does nothing. - Creating an agent invokes that helper on focus in
DynamicAddAgentPage.tsx:233–238. - Profile likewise requests scrolling when its prompt receives focus, with Save following the input:
AgentAIPromptSection.tsx:205–237. - Form submit buttons default to placement inside scroll content:
FormWrapper.tsx:298–311.
Challenge to the hypothesis: This explains a button remaining below the visible viewport, but does not establish whether the reported device instead fails to resize correctly. Native measurements of keyboard top, viewport height, scroll offset, and button bounds are needed to distinguish those cases.
The no-op predates Scroll focused form inputs together with the keyboard on native; being found during that PR’s QA does not establish that PR introduced the bug.
What changes do you think we should make in order to solve the problem?
First confirm the native layout behavior. If the viewport resizes correctly, add Android keyboard-driven scrolling that reveals the action button—not merely the input’s top edge.
Cover both the create-agent form and Profile’s inline Save; changing form-footer placement alone would miss Profile. Verify short/long prompts and keyboard dismissal/reopening before treating this as a confirmed solution. No code changes were made.
What alternative solutions did you explore? (Optional)
A global keyboard-avoidance change is not currently justified. If native measurements show failed resizing rather than insufficient scrolling, the proposed direction must be revised.
Related issues: New rule keyboard jump and Describe Rule obscured after dismissing the keyboard concern nearby keyboard behavior, but are not confirmed duplicates.
Next Steps for Contributor+ team: Native verification is required before accepting an implementation.
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/108013) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android native, when focusing the instructions/prompt input on Settings > Agents > New agent > Build custom agent, or the AI prompt input on Settings > Profile while copiloted into an agent account, the keyboard hides the Create agent / Save button. The form should slide up smoothly with the keyboard (without jumping) and keep the submit button visible above it—matching Workspace > Rules > Add rule > Or just describe it below on Android. (Settings > Agents > [agent] > Write custom instructions, DynamicEditPromptPage, uses the identical helper and has the same issue.)
What is the root cause of that problem?
Confirming and completing MelvinBot's code-level finding: all three Agent prompt editors route their focus scroll through scrollToMultilineInput, whose default (Android + web) implementation is an empty no-op.
-
src/pages/settings/Agents/scrollToMultilineInput/index.ts#L3-L5is resolved on Android and web:// This function is only needed on iOS where there is no auto scroll to the multiline text input on focus. // eslint-disable-next-line @typescript-eslint/no-unused-vars function scrollToMultilineInput(scrollWithKeyboard: ScrollWithKeyboard, shouldScrollToMultilineInput: boolean, inputTopOffset: number) {}Only
index.ios.ts#L3-L8actually callsscrollWithKeyboard(inputTopOffset). -
All three Agent prompt editors instantiate
useKeyboardDrivenScroll(scrollViewRef)(introduced in #106203 specifically to drive smooth keyboard-synced scrolling on both iOS and Android—includingSETTLE_DELAY_MS = 400to outlast Android's own 250 ms focus scroll,useKeyboardDrivenScroll/index.native.ts#L13-L17), yet only invoke it throughscrollToMultilineInput:- Create agent:
DynamicAddAgentPage.tsx#L85-L86,#L233-L238,#L315-L321 - Profile AI prompt Save:
AgentAIPromptSection.tsx#L145-L146(scrollToMultilineInput(scrollWithKeyboard, true, Number.MAX_SAFE_INTEGER)), wired toonFocusat#L222 - Edit custom instructions Save:
DynamicEditPromptPage.tsx#L56-L63
- Create agent:
-
Because the submit buttons render inside the
ScrollViewcontent below the prompt (FormWrapper.tsx#L251andAgentAIPromptSection.tsx#L226-L237), Android's defaultscrollsChildToFocus={true}only reveals the focusedTextInput, leaving the Create agent / Save button behind the keyboard. -
Comparing with the working Rules screen (
DescribeRuleForm.tsx), which uses the exact sameScreenWrapper+ KAV +FormProvider+useKeyboardDrivenScrollstack, there are exactly two differences:DescribeRuleFormrunsscrollWithKeyboardon both iOS and Android (#L293-L299), clamping at the end of content so the submit button stays visible.DescribeRuleFormsetsshouldScrollChildToFocus={false}(#L320-L321) per the documented contract inForm/types.ts#L231-L232("Set it to false when the form scrolls to the input itself") so Android does not trigger a competing focus scroll that causes a visible jump.
What changes do you think we should make in order to solve the problem?
-
Enable
scrollToMultilineInputon all native platforms (iOS + Android) while keeping web as a no-op:- Rename
src/pages/settings/Agents/scrollToMultilineInput/index.ios.ts→src/pages/settings/Agents/scrollToMultilineInput/index.native.ts(implementation unchanged; update comment to explain both iOS and Android). - Keep
src/pages/settings/Agents/scrollToMultilineInput/index.tsas the web no-op and update its comment.
- Rename
-
Disable Android's competing focus scroll on the Agent prompt scroll views (matching
DescribeRuleFormso the form slides up smoothly once without jumping):- In
src/pages/settings/Agents/DynamicAddAgentPage.tsx#L262-L274, passshouldScrollChildToFocus={false}on<FormProvider>(note:agentNamesits near the top of the form right below the avatar; we will also verify landscape focus onagentNameduring Android testing and scope/keepshouldScrollChildToFocusaccordingly if landscape focus needs native scroll). - In
src/pages/settings/Agents/Fields/DynamicEditPromptPage.tsx#L111-L125, passshouldScrollChildToFocus={false}on<FormProvider>. - In
src/pages/settings/Profile/ProfilePage.tsx#L290-L296, passscrollsChildToFocus={!isAgentAccount}on<ScrollView>(ScrollViewspreadsRNScrollViewProps, matchingFormWrapper.tsx#L302) so non-agent profiles keep their existing behavior untouched while agent profiles letAgentAIPromptSectionown the scroll to Save.
- In
-
Tests:
- Add unit test
tests/unit/pages/settings/Agents/scrollToMultilineInputTest.tsverifyingindex.native.tsinvokesscrollWithKeyboard(offset)only whenshouldScrollToMultilineInputistrue, while webindex.tsremains a no-op. - Extend
tests/unit/pages/settings/AddAgentPageTest.tsx,EditPromptPageTest.tsx, andtests/ui/ProfilePageTest.tsxto assertshouldScrollChildToFocus={false}/scrollsChildToFocus={!isAgentAccount}. - Manually verify on Android (and iOS regression check):
- Build custom agent → tap Instructions → smooth single slide, Create agent visible above keyboard (normal + >10-line prompt + landscape rotation +
agentNamefocus). - Copilot into agent → Settings > Profile → tap AI prompt → smooth slide, Save visible above keyboard.
- Edit custom instructions (
DynamicEditPromptPage) → tap prompt → Save visible. - Dismiss/reopen keyboard, user drag mid-animation, and Rules > Add rule regression check.
- Build custom agent → tap Instructions → smooth single slide, Create agent visible above keyboard (normal + >10-line prompt + landscape rotation +
- Add unit test
What alternative solutions did you explore? (Optional)
- Sticky submit footer (
shouldSubmitButtonStickToBottom): Would only cover the twoFormProviderpages (notAgentAIPromptSection's inlineButtononProfilePage) and diverges from the Rules design pattern established in#106203. - Removing
scrollToMultilineInputand callingscrollWithKeyboarddirectly in all 3 screens: Equivalent on native, but larger diff and loses the clean web no-op platform split. - Skipping step 2 (
shouldScrollChildToFocus={false}):useKeyboardDrivenScroll's 400 msSETTLE_DELAY_MSwould eventually re-apply the offset, but Android's native 250 ms focus scroll would still cause a visible two-step jump—failing the "without jumping" expected result.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01aee0111e1a0ae483
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Hello is it i can do it this task ?
📣 @RamoDevAI! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue?
On Android, when building a custom agent or editing an agent's prompt (Settings > Agents > New agent > Build custom agent, or Settings > Profile > AI prompt), tapping the prompt text input opens the keyboard, but the "Create agent" and "Save" buttons remain hidden behind the keyboard instead of sliding smoothly into view above it.
What is the root cause of that problem?
In src/pages/settings/Agents/DynamicAddAgentPage.tsx (lines 57, 237, 319) and src/pages/settings/Agents/Fields/DynamicEditPromptPage.tsx (lines 27, 62, 138), the component calls:
scrollToMultilineInput(scrollWithKeyboard, shouldUseScrollableLayout, promptTopOffsetRef.current);
Looking at src/pages/settings/Agents/scrollToMultilineInput/:
index.ios.tsimplements the scroll trigger for iOS:
function scrollToMultilineInput(scrollWithKeyboard: ScrollWithKeyboard, shouldScrollToMultilineInput: boolean, inputTopOffset: number) {
if (!shouldScrollToMultilineInput) {
return;
}
scrollWithKeyboard(inputTopOffset);
}
export default scrollToMultilineInput;
index.tsis an empty stub:
function scrollToMultilineInput(scrollWithKeyboard: ScrollWithKeyboard, shouldScrollToMultilineInput: boolean, inputTopOffset: number) {}
export default scrollToMultilineInput;
Because the implementation file is named index.ios.ts and there is no index.android.ts or index.native.ts, React Native's Metro bundler resolves index.ts on Android!
Therefore, on Android, scrollToMultilineInput is an empty no-op. When the multiline input receives focus on Android, scrollWithKeyboard is never invoked, leaving the submit buttons completely hidden beneath the soft keyboard.
Furthermore, on Android native, ScrollView / FormProvider has shouldScrollChildToFocus behavior enabled by default, which competes with useKeyboardDrivenScroll and causes visible double-jump stuttering if not disabled.
What changes do you think we should make in order to solve the problem?
1. Rename index.ios.ts to index.native.ts
Rename src/pages/settings/Agents/scrollToMultilineInput/index.ios.ts → src/pages/settings/Agents/scrollToMultilineInput/index.native.ts:
This ensures both iOS and Android utilize the native scrollWithKeyboard implementation while Web continues using the no-op in index.ts.
2. Prevent Competing Focus Scroll on Android
- In
src/pages/settings/Agents/DynamicAddAgentPage.tsx: PassshouldScrollChildToFocus={false}to<FormProvider>. - In
src/pages/settings/Agents/Fields/DynamicEditPromptPage.tsx: PassshouldScrollChildToFocus={false}to<FormProvider>. - In
src/pages/settings/Profile/ProfilePage.tsx: PassscrollsChildToFocus={!isAgentAccount}on<ScrollView>.
This allows useKeyboardDrivenScroll to smoothly animate the form scroll offset so that "Create agent" and "Save" are cleanly positioned above the keyboard without any jerky dual-scroll jumps.
What alternative solutions did you explore? (Optional)?
We considered using a sticky footer (shouldSubmitButtonStickToBottom). However, ProfilePage.tsx renders AgentAIPromptSection inline within the general profile scroll view where sticky footers break the profile layout hierarchy. Utilizing useKeyboardDrivenScroll via index.native.ts provides a unified, proven architecture across all native platforms that matches the pattern established in #106203.
What are the regression risks and how will you mitigate them?
- Web platform: Web continues to use
index.tsstub where native keyboard scrolling does not apply. - iOS platform: Renaming
index.ios.tstoindex.native.tskeeps iOS behavior 100% identical asindex.native.tstargets both iOS and Android equally. - Other FormProvider forms:
shouldScrollChildToFocus={false}is scoped specifically to the agent pages utilizing keyboard-driven scroll, leaving other forms unaffected.
Automated Tests?
Add unit tests verifying:
scrollToMultilineInputinvokesscrollWithKeyboardwhen called on native platforms (index.native.ts).scrollToMultilineInputno-ops cleanly on web (index.ts).
Manual Test Steps?
- Open the app on Android.
- Navigate to Settings > Agents > New agent > Build custom agent.
- Tap on the instructions/prompt multiline text input to open the soft keyboard.
- Verify that the page smoothly scrolls up and the "Create agent" button remains visible above the keyboard.
- Navigate to Settings > Profile > AI prompt (or copiloted agent profile).
- Tap on the prompt input.
- Verify that the "Save" button remains visible above the keyboard without double-scroll jitter.
Contributor Details?
- GitHub Username: @kevinjosh10
- Email: [email protected]
- Upwork Profile: https://www.upwork.com/freelancers/~0131dae36abcf59374
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/omarhdev1?viewMode=1
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Hi, I've completed my contributor registration and reviewed the contributing guidelines. I'm interested in working on this issue.
Could you please confirm whether you are still accepting new proposals for this task? I'd be happy to investigate the issue and submit my own technical proposal.
Thank you!
@eVoloshchak Eep! 4 days overdue now. Issues have feelings too...
Triggered auto assignment to @jasperhuangg, see https://stackoverflow.com/c/expensify/questions/7972 for more details.