[Due for payment 2026-12-08] [$250] Web- Wallet - The popup moves is not repositioned properly after the window is resized
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v9.4.75-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: https://github.com/Expensify/Expensify/issues/360448 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team
Action Performed:
- Open NewDot in the browser and log in
- Open the Settings tab > Wallet
- Click on the bank account to display the context popup
- Resize the viewport (open and close the browser developer tools pane)
Expected Result:
The popup is repositioned properly after the window is resized
Actual Result:
The popup is not repositioned properly after the window is resized
Workaround:
N/A
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome / Safari
Screenshots/Videos
https://github.com/user-attachments/assets/51476942-43c0-421e-b4b3-904736f5b3e9
Issue Owner
Current Issue Owner: @eVoloshchakUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022115801979257491415
- Upwork Job ID: 2115801979257491415
- Last Price Increase: 2026-11-12
Proposal
What is the root cause of that problem?
The Wallet page used to own a reposition-on-resize handler for this popup. It was deleted in a refactor and nothing replaced it.
This is the third report of this exact bug on this exact page:
| Report | Fix | What it did |
|---|---|---|
| Expensify/App#31706 (2023) | Expensify/App#32492 (2024-01-02) | Added Dimensions.addEventListener('change', …) in WalletPage to re-measure the anchor and reposition the open popup |
| Expensify/App#61801 (2025) | Expensify/App#62668 (2025-05-29) | Replaced the listener (stale closure) with useLayoutEffect(…, [windowWidth, windowHeight]) |
| this issue | — | The handler no longer exists |
Expensify/App#67326 ("Partially setup account", merged 2025-11-30) deleted src/pages/settings/Wallet/WalletPage/WalletPage.tsx (−727 lines) and moved the popup into the generic ThreeDotsMenu. The shouldListenForResize / setMenuPosition machinery went with it. Confirmed leftovers of the deleted handler: WalletPage/index.tsx:124 still declares paymentMethodButtonRef, assigns it at :155 and :244, and never reads it — it was the anchor the old handler measured.
Clicking the row now opens a ThreeDotsMenu (PaymentMethodListItem.tsx:157-172, mounted at :233-244), whose only reposition path is ThreeDotsMenu/index.tsx:137-145. That generic effect is weaker than the handler it replaced in two ways I can point at in code:
- It anchors at the origin when the width breakpoint is crossed.
usePopoverPosition.ts:62-66short-circuits to{horizontal: 0, vertical: 0, width: 0, height: 0}wheneverisSmallScreenWidthis true. Chrome docks DevTools to the right by default, so "open the developer tools pane" shrinks the width — crossing the 800px breakpoint makes the recalculation return the origin instead of the row. That matches the original report's wording, "the popup moves to the side." - The re-measure is no longer debounced. The old fix deliberately debounced by
CONST.TIMING.RESIZE_DEBOUNCE_TIME— still defined atCONST/index.ts:2244but now unused by any Wallet code. The generic effect measures viameasureInWindow(async on web) on every dimension tick, while the row sits in aFlashListthat re-lays-out its absolutely-positioned cells after the resize — so it can read pre-resize coordinates and write them straight back.
Its dependency array is also unstable: anchorAlignment is an inline object literal at PaymentMethodListItem.tsx:239 and calculatePopoverPosition isn't memoized, so the effect re-fires on every render and its timing relative to the resize is non-deterministic.
What changes do you think we should make in order to solve the problem?
Fix it in the shared components, not with a fourth Wallet-specific patch:
- In
usePopoverPosition, stop returning the origin when recalculating for an already-open popover. Either measure regardless of screen width, or have the caller dismiss / switch to the bottom-docked variant when the viewport crosses into small-screen width, so it never renders anchored at0,0. - In
ThreeDotsMenu, debounce the re-measure byCONST.TIMING.RESIZE_DEBOUNCE_TIMEso it runs after the list has re-laid out, and stabilise the effect's dependencies (memoizeanchorAlignmentat the call site andcalculatePopoverPositionin the hook) so it fires on dimension change rather than on every render. - Delete the dead
paymentMethodButtonRefinWalletPage/index.tsx.
CopilotPage.tsx:164-175 still carries a working copy of the original pattern, so it is a useful reference for expected behaviour — and a sign this logic should live in the shared component rather than being re-implemented per page.
What alternative solutions did you explore? (Optional)
Investigation details, and what I could not confirm
Confidence: medium. The archaeology is verified directly against the code and PR history. What I could not confirm is which link in the generic ThreeDotsMenu path fails at runtime — I traced the whole downstream chain (PopoverMenu's memo comparator deep-compares anchorPosition; PopoverWithMeasuredContentBase:121-198 recomputes from anchorPosition plus live window dimensions) and it does react to position changes, so I could not statically prove the failure point. The two mechanisms above are ranked candidates, not a confirmed single cause.
I attempted a browser repro to discriminate between them, but the test session failed to render (blank page, unrelated to this bug), so there is no runtime evidence in this analysis. Whoever picks this up should verify by opening the popup and then (a) shrinking height only, and (b) shrinking width across 800px, logging isSmallScreenWidth and the position state in ThreeDotsMenu. Case (b) failing while (a) passes confirms mechanism 1; both failing points at mechanism 2.
Alternative explanation considered and not ruled out: FlashList cell recycling. The rows moved from FlatList to @shopify/flash-list; a resize forces a re-layout, and a recycled cell could carry ThreeDotsMenu's open state onto a different row's anchor. Testing the same shouldSelfPosition menu outside a FlashList (the report header ⋯ menu) would isolate this.
Related issues: no open duplicates. The two prior reports, Expensify/App#31706 and Expensify/App#61801, are both closed.
Regression-test gap: the test that caught this only covers the Wallet page. Since the popup is now a shared component, the coverage should follow it there.
💡 Suggested AI code review rule
This is the third recurrence of the same bug class, and the codebase has at least three independently hand-written copies of the "reposition on resize" logic, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:
- Rule:
UI-4— Anchored popovers must recompute their anchor position on viewport change - Condition: When a component stores a popover
anchorPositionmeasured from a ref, it must recompute that position while the popover is open whenever the window dimensions change, and must never fall back to{0, 0}for an already-open popover. Flag any change that removes such a recompute without providing an equivalent — an anchor ref left assigned but never read is the fingerprint. - Why: Deleting the page-level resize handler leaves the popup pinned to pre-resize coordinates or anchored at the origin. Regressed three times on the same page: Expensify/App#31706 → Expensify/App#61801 → this issue.
- Search pattern:
usePopoverPosition|calculatePopoverPosition|measureInWindow|getBoundingClientRectfeeding ananchorPositionprop, withoutwindowWidth/windowHeightin the recompute effect's deps or aDimensions.addEventListener('change'; plus removed hunks matchingDimensions.addEventListener\('change'oruseLayoutEffect\(.*\[windowWidth, windowHeight\]near a popover. - Behaviour removed (❌):
WalletPage.tsx:303-312before the refactor - Working reference (✅):
CopilotPage.tsx:164-175
If it's worth adding, a maintainer can open it as a draft PR in Expensify/App's coding-standards skill (next free number is UI-4).
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/100882) 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
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
@MelvinBot, implement this
⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.
@eVoloshchak Whoops! This issue is 2 days overdue. Let's get this updated quick!
@eVoloshchak Still overdue 6 days?! Let's take care of this!
@MelvinBot, implement https://github.com/Expensify/App/issues/100882#issuecomment-5624992007
🤖 Draft PR created: Fix wallet popup not repositioning after a viewport resize
Please mark it as "Ready for review" when it is ready for review.
What I changed — fixed it in the shared components rather than adding a fourth Wallet-specific patch:
ThreeDotsMenu/index.tsx:143-160now debounces the reposition measurement byCONST.TIMING.RESIZE_DEBOUNCE_TIME, so a resize collapses into one measurement taken after the layout has settled. Previously it re-measured on every intermediate dimension tick, which can read the anchor's pre-resize coordinates (the row lives in aFlashListthat re-lays-out after the resize) and write them straight back. This matches the pattern already used byDatePicker/index.tsx:194-202andCopilotPage.tsx:171-181.- Stabilised that effect's dependencies —
calculatePopoverPositionis memoized inusePopoverPosition.ts:66-81, and bothanchorAlignmentobject literals (theThreeDotsMenudefault and the one inPaymentMethodListItem) are hoisted to module scope. The effect now fires on dimension change instead of on every render. - Deleted the dead
paymentMethodButtonRefinWalletPage/index.tsx:124. That also drops two grandfatheredno-unsafe-type-assertionentries from the ESLint seatbelt.
What I deliberately did not change. The proposal's first mechanism — usePopoverPosition returning {horizontal: 0, vertical: 0} when isSmallScreenWidth — is not reachable as a mispositioning bug. When isSmallScreenWidth is true, Popover/index.tsx:146-149 renders a BOTTOM_DOCKED modal and explicitly passes popoverAnchorPosition={undefined}, so the origin value is never used for positioning. Changing it would be a no-op here and would alter behavior for every other popover, so I left it alone. That leaves the debounce/stale-measurement mechanism as the fix.
Checks I ran
npm run lint-changed— passednpm run typecheck— passednpm run react-compiler-compliance-check check <changed files>— passednpm run spell-changed— passed (4 files, 0 issues)npm teston the related suites (usePopoverPositionTest,RecentlyAddedSectionTest,SearchActionsBarCreateButtonTest,FocusTrapForModalTest) — 44 tests passed
⚠️ I could not verify this in a browser. The web test environment failed to come up in this run, so the fix has not been confirmed against the reported repro. Before marking the PR ready, please check: open the Wallet popup, then (a) shrink the height only and (b) shrink the width across the 800px breakpoint, and confirm the popup stays anchored to its row in both cases. Also worth a quick regression pass on other three-dots menus, since ThreeDotsMenu is shared.
One related leftover I left out of scope: WorkspaceInvoiceVBASection.tsx has the same dead paymentMethodButtonRef pattern (declared and assigned, never read).
@eVoloshchak this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@eVoloshchak Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@eVoloshchak 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@eVoloshchak Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
Checking https://github.com/Expensify/App/pull/101918
@eVoloshchak Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@eVoloshchak Eep! 4 days overdue now. Issues have feelings too...
@eVoloshchak this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!
@eVoloshchak Still overdue 6 days?! Let's take care of this!
This is no longer reproducible, but I can't find any PRs that would fix this. Let's confirm. @MelvinBot please add a retest label and put https://github.com/Expensify/App/pull/101077 on hold
https://github.com/user-attachments/assets/7f6c615a-bd1b-4ed4-b738-499c7140629b
Done:
- Added the
retest-weeklylabel to this issue so Applause retests it. - Put [HOLD] Reposition three-dots popover menus after a viewport resize on hold. I added the
HOLDlabel and the[HOLD]title prefix.