Skip to content

Keep the search router open when the window is resized - #103577

Merged
marcochavezf merged 2 commits into
mainfrom
claude-searchRouterStayOpenOnResize
Oct 14, 2026
Merged

marcochavezf merged 2 commits into
mainfrom
claude-searchRouterStayOpenOnResize

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The search router popover closed itself on every window resize on wide layouts. SearchRouterModal subscribed to the Dimensions change event and called closeSearchRouter(), so any resize dismissed the popover and lost the typed query.

That listener was a workaround from when the popover was pinned to a corner and shifted by the Side Panel offset, so it mispositioned on resize. Since #100831, the popover is centered on the viewport, and its anchor and max height come from windowHeight, so it repositions itself on re-render. This PR removes the listener and the now-unused useEffect and Dimensions imports, so the popover stays open and reflows as the window resizes.

AI tests run (by MelvinBot):

  • ESLint on the changed file: passed
  • npm run typecheck: app config passed. One failure in tests/unit/OptionsListUtilsTest.tsx already exists on main and is not related to this PR.
  • React Compiler compliance check on the changed file: passed
  • Jest: getSearchRouterPopoverLayoutTest, SearchRouterNavigationTest, SearchRouterUtilsTest, SearchAutocompleteListTest: 101/101 passed
  • Web check in a dev build: the popover stays open and keeps its typed text across resizes (1440x900 → 1420x890 → 1000x700 → 1440x900). It also stays usable after crossing the narrow breakpoint (500x800) and back. No console errors. Screenshots are under MacOS: Chrome / Safari below.

Fixed Issues

$ #101231
PROPOSAL: #101231 (comment)

Tests

Same as QA steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA steps

QA Steps

  1. Open App with desktop browser
  2. Open global search to open search popover
  3. Resize browser window
  4. Verify that search popover adjusts properly with window size
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Captured by MelvinBot in a headless dev web build:

Search router open with typed text at 1440x900 Search router still open and centered after resizing to 1000x700 Search router recentered after resizing back to 1440x900 Search router usable after a narrow and wide round trip Search router dismissed cleanly with no stuck overlay

Co-authored-by: Eric Han <eh2077@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 9, 2026 10:39
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 9, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

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:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-searchRouterStayOpenOnResize
git checkout -b claude-searchRouterStayOpenOnResize upstream/claude-searchRouterStayOpenOnResize
git push -u origin claude-searchRouterStayOpenOnResize

Then you can close this PR and open a new one from your fork.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing checks are unrelated to this PR, so I didn't push a fix.

Analysis: typecheck and test (job 5) both fail in tests/unit/OptionsListUtilsTest.tsx (around line 5748). The test should return the self DM when searching "me" calls filterAndOrderOptions with 10 positional arguments. The function now takes a single object parameter, so TypeScript reports TS2554: Expected 1 arguments, but got 10. This broke on main when Match the self DM by the localized You/Me in report search merged alongside the refactor that changed the function signature.

Evidence: This PR only changes src/components/Search/SearchRouter/SearchRouterModal/index.tsx. The PR branch sits directly on the current main tip, which has the same broken test.

Fix in progress: [No QA][Failing Tests on Main] Fix the main typecheck and test failure in the self DM search test fixes this test. Once it merges, merge main into this branch (or ask me to) and the checks should pass.

Check independent approval is expected to fail until the PR gets an approval.


view run

@MelvinBot

MelvinBot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

On standalone Android NewDot, the search router opens, accepts text with live suggestions, keeps its state through a landscape/portrait rotation, and closes cleanly with Back. Logcat showed no ReactNativeJS errors or crashes during the flow.
Home screen after closing the search router, no stuck overlay

Step Status
Open the search router and type "test"; it opens and shows the typed text with suggestionsThe text field showed "test" (focused) with suggestions: Ask Concierge “test”, recent chats, and a "test" search result.
Search router open with test typed and suggestions visible
✅
Rotate to landscape and back to portrait with the router open; it stays usable, keeps the text, and does not crashIn landscape and again in portrait, the text field still showed "test" with the full suggestion list. No crash or red error screen appeared.
Search router in landscape with test preserved
Search router back in portrait with test preserved
✅
Close the search router with Back; it dismisses with no stuck overlayBack returned to the normal Home screen with no leftover search overlay or text field.
Home screen after closing the search router, no stuck overlay
✅
Verify that no errors appear in the JS consoleLogcat showed no ReactNativeJS errors, AndroidRuntime errors, or fatal exceptions. The only entry was one Reanimated strict-mode warning ("Writing to value during component render"), which is not related to this PR. The app stayed in the foreground throughout.
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

On dev NewDot web, the search router popover stays open, keeps its typed text, and recenters through several resizes at wide layout, then closes cleanly on click-outside. The browser console couldn't be read directly, so the "no JS console errors" step is backed only by indirect evidence.
Home page after dismissing the search router, no stuck overlay

Step Status
At 1440x900, open the search router and type "test"; the popover opens with the typed text and suggestionsThe dialog showed "test" in the text field with suggestions (Ask Concierge "test", Go to Overview, recent chats), centered on screen.
Search router open at 1440x900 with test typed and suggestions visible
✅
Resize to 1420x890, then 1000x700; the popover stays open, keeps "test", and stays centeredAt both sizes the dialog stayed open with "test" and the full suggestion list, centered in the smaller viewport.
Search router still open and centered after resizing to 1000x700, test preserved
✅
Resize back to 1440x900; the popover is still open with "test" and recenteredThe popover was still open with "test", in the same position as the original open state.
Search router back at 1440x900, recentered with test still present
✅
Close the popover by clicking outside; it dismisses with no stuck overlayClicking outside removed the dialog and its suggestions. The normal Home page showed with no leftover overlay.
Home page after dismissing the search router, no stuck overlay
✅
Verify that no errors appear in the JS consoleThe test tool can't read the browser console on web, so this was not checked directly. Indirect evidence: every API call during the flow returned 200, and no error banners or broken UI appeared in any screenshot.
⚠️

view run · view recording

@eh2077

eh2077 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Tests

Same as QA steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA steps

QA Steps

  1. Open App with desktop browser
  2. Open global search to open search popover
  3. Resize browser window
  4. Verify that search popover adjusts properly with window size
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@eh2077

eh2077 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot apply #103577 (comment) to update PR description and mark it ready for review, thx!

@eh2077

eh2077 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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 Issues section 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 Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • 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 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 any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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 using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • 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
    • 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 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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 main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp

NA

Android: mWeb Chrome

NA

iOS: HybridApp

NA

iOS: mWeb Safari

NA

MacOS: Chrome / Safari
Screen.Recording.2026-10-13.at.10.35.35.PM.mov

@MelvinBot
MelvinBot marked this pull request as ready for review October 13, 2026 14:48
@MelvinBot
MelvinBot requested a review from a team as a code owner October 13, 2026 14:48
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the PR description with the sections from your comment and marked the PR ready for review.

  • Tests, Offline tests, QA Steps, and the PR Author Checklist now match your comment. All checkboxes are checked and no TODO lines remain.
  • I kept my existing web screenshots under MacOS: Chrome / Safari. Your comment left that section empty.

view run

@melvin-bot
melvin-bot Bot requested review from eh2077 and flaviadefaria and removed request for a team and flaviadefaria October 13, 2026 14:48
@melvin-bot

melvin-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

@eh2077 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team October 13, 2026 14:49
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T14:57:10.285908Z 452bef8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@eh2077 eh2077 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works well!

@melvin-bot
melvin-bot Bot requested a review from marcochavezf October 13, 2026 15:38
@eh2077

eh2077 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Oh, wait a minute. @MelvinBot please merge with main branch to see if failed checks will be fixed.

…ayOpenOnResize

Co-authored-by: Eric Han <eh2077@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 13, 2026 15:51
@melvin-bot
melvin-bot Bot requested review from eh2077 and removed request for a team October 13, 2026 15:51
@melvin-bot

melvin-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

@eh2077 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]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch, and the typecheck and test (job 5) failures are now fixed.

  • The merge had no conflicts. The PR diff is still only SearchRouterModal/index.tsx.
  • All test jobs and typecheck pass on the new commit.
  • Only Check independent approval still fails. It needs a reviewer approval, not a code change.

view run

@marcochavezf
marcochavezf merged commit 7a9dc98 into main Oct 14, 2026
42 of 43 checks passed
@marcochavezf
marcochavezf deleted the claude-searchRouterStayOpenOnResize branch October 14, 2026 04:10
@github-actions

Copy link
Copy Markdown
Contributor

🚧 marcochavezf has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.5.9-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This is a bug fix: the search popover now stays open when you resize the browser window, which is what users already expect, and no article describes the old behavior.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.9-4 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants