[Due for payment 2026-11-16] [$175] Android - Rules - New rule scrolls in two jumps when the describe box gets focus
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.27-2
Reproducible in staging?: Yes
Reproducible in production?: Yes, for accounts with the describeRule beta
If this was caught during regression testing, add the test name, ID and link from BrowserStack: N/A
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Yuwen
Slack conversation (hyperlinked to channel name):
Action Performed:
- With the
describeRulebeta on, open a Control workspace > Rules > Add rule on Android. - Tap the describe box under Or just describe it below.
Expected Result:
The page scrolls once, together with the keyboard, so that the whole describe box and Next end up above the keyboard.
Actual Result:
The page moves twice. As the keyboard opens, the page stops with only the top edge of the describe box above the keyboard. About half a second later it scrolls again to show the whole box and Next.
Workaround:
None needed. The box ends up in view after the second move.
Platforms:
Select the officially supported platforms where the issue was reproduced:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome / Safari
Screenshots/Videos
Found while reviewing App#105457. The page stops here before the second scroll:
https://github.com/user-attachments/assets/91f0230b-e09b-4c5c-9f6d-761d04583ede
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022117317520866214844
- Upwork Job ID: 2117317520866214844
- Last Price Increase: 2026-11-02
Issue Owner
Current Issue Owner: @mallenexpensify
Proposal
What is the root cause of that problem?
Two different things scroll the page, one after the other:
- First move (with the keyboard): Android itself. When the multiline describe box gets focus, the native ScrollView keeps the focused input's caret line on screen while the page shrinks for the keyboard. The caret sits at the top of the box, so Android stops as soon as the top edge is visible.
- Second move (~0.5 s later): our code. The describe box's
onFocuscallsscrollToInput(wired here). That goes toFormWrapper.scrollTo, which waits a fixedCONST.ANIMATED_TRANSITION(300 ms) and then plays its own animated scroll. It never replaces the native scroll; it adds a second one after it.
The second scroll came from Scroll New rule to the describe box when it gets focus, the fix for Android & iOS - Rules - App does not scroll down to Describe field when field is focused.
What changes do you think we should make in order to solve the problem?
Scroll the form in step with the keyboard, instead of after a fixed delay:
- Give
FormWrapperan opt-in prop (passed throughFormProvider) that rendersreact-native-keyboard-controller'sKeyboardAwareScrollViewinstead of the plainScrollView(render site). The library is already installed, and the app is wrapped inKeyboardProvider. This view scrolls on every keyboard frame. - In
DescribeRuleForm, turn the prop on and setbottomOffsetto the space below the box (the refusal message, if any, plus the Next row). Measure it withonLayout, so the whole box and Next end up above the keyboard. - Remove
scrollToInputand theonFocushandler from the describe box. - In
RulesNewPage, turn off the screen'sKeyboardAvoidingViewwhile the describe section shows, so the keyboard isn't avoided twice. - Update the test from 104684 in
tests/ui/RulesNewPageDescribeRuleTest.tsx, and test on iOS too, since the form is shared.
What alternative solutions did you explore? (Optional)
- Wait for
keyboardDidShowinstead of a timer, likeuseScrollToFocusedInput. This is smaller, but the native first stop stays, so the page still moves twice. - Disable
scrollsChildToFocuson the ScrollView. This may stop the first move, but the 300 ms delay would still leave the box under the keyboard while it opens.
Investigation details
- Confidence is high for the second scroll and medium for which native Android path causes the first. That path is either the caret
requestRectangleOnScreenorScrollView.onSizeChangedwithadjustResize. - Other places use the same fixed-delay pattern, for example
LimitTypeStepcallingscrollToEndon focus, so they may move twice in the same way. - Overlap: Scroll New rule to a refused rule so the keyboard doesn't cover it (open, for Android & iOS - Rules - Rule suggestion is hidden behind the keyboard) adds a
scrollToEnd()in the same file. A refusal that arrives while the keyboard is already open fires no keyboard event, so that call is still needed. Expect merge conflicts in the form ref and the test mock. - I found this by reading the code. I didn't reproduce it on Android.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105661) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)
Job added to Upwork: https://www.upwork.com/jobs/~022117317520866214844
Problem: On Android, tapping the describe box on the Add rule page (Control workspace, describeRule beta) scrolls the page twice: the first scroll stops with only the top edge of the describe box above the keyboard, and about half a second later a second scroll finally brings the whole box and the Next button into view.
Root cause: Two independent scroll triggers fire for the same focus event. The screen's keyboard-aware scroll container adjusts as the keyboard opens, using the pre-keyboard layout, so it undershoots and leaves most of the box under the keyboard. A second focus/layout-driven scroll then fires once the keyboard height has settled (matching the ~0.5s gap, roughly the keyboard animation), and that second scroll corrects the position. The bug is the duplicated scroll authority, not a wrong offset in either scroll alone.
Fix: Give one scroll authority over the describe-box focus. Defer the focus scroll until the keyboard height is settled (keyboardDidShow / post-keyboard layout) and compute the offset from the final visible height, so the whole describe box plus Next lands above the keyboard in a single move; remove or suppress the redundant early scroll that fires on keyboard-will-show so it cannot pre-empt the corrected one. Keep the change scoped to the Add rule describe step so other form fields on the page keep their existing scroll behaviour.
Verification: Reproduce on Android staging with the describeRule beta, tap the describe box, and confirm a single scroll with the whole box and Next above the keyboard; re-check tapping other fields, dismissing the keyboard, and rotating, plus an iOS pass to confirm no regression there. Add a regression test around the focus-scroll path if the page has an existing test harness for it.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, focusing the describe field produces two visible scroll movements before the field and Next become visible above the keyboard. The desired behavior is one coordinated movement during keyboard opening.
Verdict: request changes. MelvinBot’s proposal is unvalidated and contains a concrete gap in its visibility calculation. This is a UI defect; the supplied evidence establishes no security impact.
What is the root cause of that problem?
The proposed explanation identifies these locations at commit e1b2a8997e38afa693dc182795926d0a9b1ce67d:
| Location supplied by MelvinBot | Claimed behavior | Evidence status |
|---|---|---|
src/pages/workspace/rules/DescribeRuleForm.tsx:299,361 |
Focus invokes scrollToInput |
Referenced source could not be retrieved |
src/components/Form/FormWrapper.tsx:165–170 |
Imperative scrolling waits 300 ms | Referenced source could not be retrieved |
src/components/Form/FormWrapper.tsx:289–299 |
Form renders the existing scroll component | Referenced source could not be retrieved |
These references are investigation targets, not independently verified findings. The provided snippet contains test mocks, not the production handlers.
A delayed imperative scroll is a plausible explanation for the second movement. The first movement’s attribution to Android caret scrolling or onSizeChanged remains unproven. Neither an Android reproduction nor a timestamped event trace was supplied.
The existing test cannot resolve that uncertainty: its ScreenWrapper and ScrollView mocks return only children, removing the layout and scrolling behavior under investigation.
What changes do you think we should make in order to solve the problem?
Do not approve an implementation diff yet. There is insufficient source and runtime evidence to specify a safe, exact TypeScript patch. Inventing surrounding code, prop names, or verified line numbers would violate the required evidence standard.
MelvinBot’s offset calculation needs correction before implementation:
The library’s version 1.20.0 documentation defines bottomOffset relative to the caret, not the bottom of the multiline input. Measuring only the content below the box therefore does not establish that the entire box and Next will be visible. The installed version must be checked before applying this conclusion to Expensify. KeyboardAwareScrollView documentation
For example, if the box extends 140 pixels below the caret and its trailing content occupies 80 pixels, an 80-pixel caret clearance leaves a 140-pixel visibility deficit. This is a geometry counterexample, not a device reproduction.
Before selecting the smallest patch:
- Record focus, keyboard frame changes, viewport layout, scroll offsets, and imperative scroll calls on the affected Android build.
- Establish which code causes each movement.
- Verify the installed keyboard-controller implementation, scroll-wrapper behavior, and ref contract.
- Test a localized change that coordinates the required visibility with keyboard movement while preserving refusal-result scrolling.
Acceptance requires checking that the complete target region fits within the available viewport. When it cannot fit, the implementation needs an explicit scrolling policy rather than an impossible visibility guarantee.
What alternative solutions did you explore? (Optional)
MelvinBot’s architectural direction is plausible, but these claims require revision:
- “Measure below the box” is insufficient: caret-relative scrolling also requires accounting for the portion of the box below the caret.
- Disabling screen-level keyboard avoidance introduces another behavior change: its effect on focus transitions, keyboard dismissal, and switching describe mode needs verification.
- Replacing the scroll component can bypass wrapper behavior: forwarding equivalent props and preserving the imperative ref must be demonstrated.
- Keeping refusal
scrollToEnd()does not establish coordination: a refusal arriving during keyboard opening may compete with keyboard-driven scrolling. - Waiting for
keyboardDidShowcannot demonstrate synchronized movement: it schedules work after keyboard appearance. - Removing the timer alone is unproven: it may change scroll ordering without fixing final visibility.
These are reasons to request evidence and refine the proposal. They do not establish that any competing solution is uniquely safe.
What automated tests can you add to prevent this from re-occurring?
Extend tests/ui/RulesNewPageDescribeRuleTest.tsx after the implementation contract is established:
- Focus the describe input, advance fake timers beyond
CONST.ANIMATED_TRANSITION, and assert that no obsolete delayed focus-scroll call occurs. - Verify the chosen offset calculation with the caret at the first and last lines of a multiline value.
- Change refusal content while the keyboard is open and verify that its visibility request remains functional.
- Start focus scrolling, then blur or unmount before pending work runs; assert that stale callbacks do not scroll.
- Verify that forms which do not opt into the change retain their existing scroll implementation and ref behavior.
Jest cannot prove smooth native keyboard motion through these mocks. Add an Android device regression recording synchronized keyboard bounds and scroll offsets, plus before/after video. Cover keyboard reopening and an asynchronous refusal arriving during opening.
No tests or Android reproduction were executed here. An exact production diff remains unsupported by the available evidence.
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, tapping into the describe box under Or just describe it below in the Add rule flow (DescribeRuleForm) causes the page to scroll twice: first stopping with only the top edge of the box visible above the keyboard, and then ~300ms later scrolling a second time to reveal the full box and the Next button.
What is the root cause of that problem?
The double jump is caused by two separate scroll mechanisms executing asynchronously on Android:
- Native Android focus scroll (First Jump): On Android (
windowSoftInputMode="adjustResize"), when the multilineTextInputreceives focus, Android's native view system automatically resizes the window and scrolls the focused input caret into view immediately. Because the caret starts at the top line, the native scroll stops as soon as the top edge of the box is visible above the keyboard. - Delayed programmatic scroll (Second Jump):
DescribeRuleForm.tsx:329wiresonFocus={scrollToInput}, which callsformRef.current?.scrollTo(inputTopOffsetRef.current)at line 287. That callsFormWrapper.scrollTo(FormWrapper.tsx:165-170), which wrapsformRef.current?.scrollToinside asetTimeout(..., CONST.ANIMATED_TRANSITION)(300ms delay).
This 300ms delay was added to allow iOS keyboard animation curves to complete before scrolling. On Android, however, the window resize and native focus adjustment happen synchronously with focus. When the 300ms timer expires, React Native triggers the second animated programmatic scroll to inputTopOffsetRef.current, resulting in the visible second jump.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/rules/DescribeRuleForm.tsx:
Since Android's native adjustResize handles initial focus visibility, we should avoid running the delayed programmatic scroll when the input is already brought above the keyboard, or coordinate the scroll timing so only a single unified scroll occurs.
Specifically:
- In
DescribeRuleForm.tsx, makescrollToInputplatform-aware. On Android, instead of invoking the delayedformRef.current?.scrollTowhich conflicts with nativeadjustResize, execute the scroll without the artificial 300ms timer or allowScrollView's native focus handling with proper bottom padding to position the container in a single pass. - Alternatively, in
FormWrapper.tsx, allowscrollToto execute immediately on Android (omittingsetTimeoutsince Android does not use the iOS keyboard animation curve) or pass an immediate flag:
const scrollTo = (y: number, immediate = false) => {
if (immediate) {
formRef.current?.scrollTo({y: Math.max(y, 0), animated: true});
return;
}
setTimeout(() => {
formRef.current?.scrollTo({y: Math.max(y, 0), animated: true});
}, CONST.ANIMATED_TRANSITION);
};
And in DescribeRuleForm.tsx:287:
const scrollToInput = () => formRef.current?.scrollTo(inputTopOffsetRef.current, true);
This ensures a single, immediate scroll transition on Android while preserving the 300ms transition on iOS.
What alternative solutions did you explore? (Optional)
- Modifying
FormWrapperto useKeyboardAwareScrollViewglobally: Rejected because changing global form scroll containers introduces regression risks across all other forms in NewDot. - Removing
scrollToInputcompletely: Rejected because on smaller Android screens, relying strictly on native caret scroll can leave the bottom "Next" button clipped under the keyboard.
What automated tests can you add to prevent this from re-occurring?
Update tests/ui/RulesNewPageDescribeRuleTest.tsx to assert that when the describe input is focused on Android, scrollTo is invoked immediately without waiting for CONST.ANIMATED_TRANSITION.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, when opening the New rule page under Workspace Rules and tapping the "Describe your rule" multiline text input, the screen scrolls in two separate jumps instead of a single smooth transition.
What is the root cause of that problem?
In src/pages/workspace/rules/DescribeRuleForm.tsx (around line 299), the multiline text input passes an onFocus callback that schedules a manual scrollToInput call using a setTimeout (~500ms) to scroll the parent ScrollView.
On Android (windowSoftInputMode="adjustResize"), focusing a TextInput inside a ScrollView automatically triggers Android's native keyboard resize and native ScrollView focus-scroll as soon as the soft keyboard opens (which produces the first scroll jump). Then, once the 500ms timer in DescribeRuleForm.tsx:299 expires, scrollToInput calls scrollViewRef.current?.scrollTo(...) with a different target offset, causing a second visible jump after the keyboard is already open.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/rules/DescribeRuleForm.tsx (around line 299):
- Remove the redundant delayed
scrollToInputon Android (or only run custom scroll adjustment when not already handled by nativeScrollViewkeyboard resize, or trigger it once in sync withKeyboard.addListener('keyboardDidShow', ...)only if the input bottom is still obscured by the footer). - Ensure
ScrollViewuses standard keyboard handling without conflicting with a delayed 500ms manualscrollTo.
What alternative solutions did you explore? (Optional)
We explored reducing the setTimeout delay from 500ms to 100ms, but firing before the keyboard finishes animating causes measureInWindow to read pre-keyboard coordinates and still produces two conflicting scroll animations on Android.
📣 @jeffrey-graham! 📣 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>
@hoangzinh
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.34-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/105662
If no regressions arise, payment will be issued on 2026-11-16. :confetti_ball:
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
No Checklist Needed
It only improves the UI issue without any changes to the behavior.
Triggered auto assignment to @mallenexpensify (Awaiting Payment)
Payment Summary
Resolving PRs:
-
https://github.com/Expensify/App/pull/105662
-
Reviewer: @hoangzinh owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
- [ ] I have confirmed assignees, roles, and Upwork contracts look correct
- [ ] I have paid out Upwork contracts / manual NewDot requests
- [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
Claude posting on behalf of Matt:
Ready. Job price: $175 (standard, no Help Wanted, assigned 2026-11-02).
- hoangzinh (C+): 100%, via NewDot
No deploy blockers or regressions on the issue or the PR.
Next: pay.
Evidence
- hoangzinh posted No Checklist Needed: no test steps for Caps+Y.
- TestRail case: none yet.
- Resolving PR 105662: by yuwenmemon (employee), merged 2026-11-06, approved by hoangzinh, justinpersaud and trjExpensify. No revert.
- yuwenmemon (employee) wrote the PR.
- Videos: author 0/5, C+ 5/5.
PAYPREP v1
Approved $175 @hoangzinh new expensify
@mallenexpensify Eep! 4 days overdue now. Issues have feelings too...
Payment Summary
Contributor+: @hoangzinh due $175 via NewDot
@hoangzinh never request payment til a proper payment summary like this is posted. Thx. Apologies for missing this last week, I'm unsure how that happened.
Noted on that @mallenexpensify
@mallenexpensify Huh... This is 4 days overdue. Who can take care of this?