Skip to content

Fix Copilot account search regressions - #100371

Merged
youssef-lr merged 10 commits into
Expensify:mainfrom
emkhalid:fix/96225-copilot-account-search
Sep 19, 2026
Merged

youssef-lr merged 10 commits into
Expensify:mainfrom
emkhalid:fix/96225-copilot-account-search

Conversation

@emkhalid

@emkhalid emkhalid commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

This PR adds Copilot search to both affected surfaces:

  • Shows a “Find member” input in the account quick switcher when at least 12 delegated accounts are available.
  • Shows a “Find member” input on the Copilots page when there are at least 12 combined delegates and delegators.
  • Filters Copilots by display name or email and displays the standard empty state when there are no matches.
  • Keeps the quick-switcher search above the scrollable account list and clears it when the popover closes.
  • Prevents account-selection keyboard shortcuts from intercepting input while the user is searching.

The shared PopoverMenu search behavior is opt-in, and the existing SearchBar icon remains enabled by default for current consumers.

Fixed Issues

$ #96225
PROPOSAL: #96225 (comment)

Tests

Same as the QA Steps below.

  • Verify that no errors appear in the JS console

Offline tests

Same as the offline verification included in the QA Steps below.

QA Steps

Preconditions:

  • Use an account with at least 12 accounts available through Copilot access.
  • Ensure the account has at least 12 combined relationships on the Copilots page.
  1. Open Settings.
  2. Press Switch beside the current account.
  3. Verify the “Find member” input appears above the account list.
  4. Search using part of a Copilot’s display name and verify only matching accounts appear.
  5. Search using part of a Copilot’s email and verify only matching accounts appear.
  6. Enter a query with no matches and verify the standard no-results message appears.
  7. Clear the query and verify the complete list returns.
  8. Close and reopen the switcher and verify the query is cleared.
  9. Verify the popover uses the correct width on desktop.
  10. On a narrow screen, verify the bottom drawer uses the full available width and is not narrow or centered.
  11. Open Settings → Copilot.
  12. Verify search appears when there are at least 12 combined displayed Copilot relationships.
  13. Search by display name and email and verify both sections are filtered.
  14. Verify empty section headings are hidden.
  15. Verify the no-results state appears when neither section has a match.
  16. Verify “Add copilot” remains available while filtering.
  17. Repeat with fewer than 12 entries and verify search is not displayed.
  18. Disable the network connection.
  19. Repeat the searches and verify locally available accounts are still filtered.
  20. Attempt to switch accounts while offline and verify the existing offline warning appears.
  21. Verify no unexpected console errors appear.

Known keyboard issues to be handled separately:

  • #99964: On native, the first tap on the clear button or an account while the keyboard is open may only dismiss the keyboard.
  • #99974: On desktop web, Arrow keys and Enter do not navigate results while the search input is focused.

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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 followed proper code patterns (see Reviewing the code)
    • 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 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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 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 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.
  • 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
iPhone17Pro_Expensify_App_Copilot_Quick_Switcher_Search_Input.mp4
iOS: mWeb Safari
iPhone17Pro_iOS_mWeb_Copilot_Quick_Switcher_Search_Input.mp4
MacOS: Chrome / Safari
macOS_Chrome_Web_Copilot_Quick_Switcher_Search_Input.mp4

@emkhalid
emkhalid marked this pull request as ready for review September 4, 2026 03:56
@emkhalid
emkhalid requested review from a team as code owners September 4, 2026 03:56
@melvin-bot
melvin-bot Bot requested review from eh2077 and trjExpensify and removed request for a team and trjExpensify September 4, 2026 03:56
@melvin-bot

melvin-bot Bot commented Sep 4, 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]

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3a05f4db8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 588 to 590
focused={isVisuallyFocused}
shouldSyncFocus={!isSearchInputFocused}
shouldCheckActionAllowedOnPress={false}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent Enter from switching an account while search is focused

When the searchable account switcher input has focus, this only stops the menu row from receiving DOM focus; the active ENTER shortcut still captures input events and calls selectItem(focusedIndex). After filtering, the new search effect sets that index to 0, so pressing Enter to finish a query switches to the first matching delegated account (and invokes connect) even without intentionally selecting it. Disable or guard the popover's Enter/arrow selection handlers while the search input is focused.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional. The follow-up PR addresses #99974 by keeping arrow-key navigation active while the search input is focused, scrolling the focused result into view, and allowing Enter to select it. Disabling these handlers while the input is focused would reintroduce that regression.

@codecov

codecov Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

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.

Files with missing lines Coverage Δ
src/components/FocusableMenuItem.tsx 100.00% <100.00%> (ø)
src/components/SearchBar/BaseSearchBar.tsx 100.00% <100.00%> (ø)
src/components/SearchBar/index.tsx 100.00% <100.00%> (ø)
src/pages/settings/Copilot/CopilotPage.tsx 73.29% <100.00%> (+1.95%) ⬆️
src/components/AccountSwitcher.tsx 87.50% <81.48%> (+1.53%) ⬆️
src/components/PopoverMenu/index.tsx 89.32% <73.91%> (-3.73%) ⬇️
... and 10 files with indirect coverage changes

@eh2077

eh2077 commented Sep 8, 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 proper code patterns were followed (see Reviewing the code)
    • 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 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)
  • 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 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 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 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.
  • 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
Screen.Recording.2026-09-14.at.8.03.23.PM.mov
Screen.Recording.2026-09-14.at.8.04.21.PM.mov
Android: mWeb Chrome
Screen.Recording.2026-09-14.at.8.06.26.PM.mov
iOS: HybridApp
Screen.Recording.2026-09-14.at.8.11.21.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-09-14.at.8.07.47.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-14.at.8.01.24.PM.mov

@emkhalid

emkhalid commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Resolved conflicts.

@emkhalid

emkhalid commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Resolved conflicts.

@eh2077

eh2077 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

sorry for the delay, I'll update by tmr

@eh2077

eh2077 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@emkhalid can you fill out QA steps section and add a note that keyboard navigation related issue is a known issue? I'd suggest Test section to refer QA steps, so it seems more convenient QA team, thx!

@emkhalid

Copy link
Copy Markdown
Contributor Author

@emkhalid can you fill out QA steps section and add a note that keyboard navigation related issue is a known issue? I'd suggest Test section to refer QA steps, so it seems more convenient QA team, thx!

Done, can you please review again, thanks!

@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.

looks good

@melvin-bot
melvin-bot Bot requested a review from youssef-lr September 15, 2026 09:00
@emkhalid

Copy link
Copy Markdown
Contributor Author

Resolved conflicts.

@emkhalid

Copy link
Copy Markdown
Contributor Author

@youssef-lr Could you please take a look at this? It is currently waiting for your review and approval. Thanks!

@youssef-lr
youssef-lr merged commit 61b184f into Expensify:main Sep 19, 2026
34 of 35 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 youssef-lr 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/youssef-lr in version: 9.4.91-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Yes — help site changes are required. Draft PR: Docs updates for E/A#100371 Copilot list search and label fixes

This PR adds a Find member search field to two Copilot surfaces, and neither is described anywhere in docs/articles:

Two articles updated:

Article Change
Manage-Copilot-Access.md New ## How to search your Copilot: Delegated access list section + search keywords
Act-as-a-Copilot.md New ## How to search for a Copilot account section, including the account switcher field + search keywords

I also corrected three UI labels that no longer match the product. I verified each against the live UI in a browser session and against the delegate strings in src/languages/en.ts:

  • Copilot: Delegated Access → Copilot: Delegated access (7 occurrences)
  • Change Access Level → Change access level
  • Remove Copilot → Remove copilot
Behavior documented, and what I left out

Documented from the diff: the 12-entry threshold (CONST.STANDARD_LIST_ITEM_LIMIT), matching on display name or email, filtering of both the These members can access your account: and You can access these accounts: lists, hidden headings for lists with no matches, the No results found matching "[your search term]" empty state, Add a copilot staying available while filtering, and the switcher clearing its query on close.

Left out of scope: both articles call the access levels Full Access and Limited Access, but the UI renders them as Full and Limited. That mismatch is pre-existing and unrelated to this PR, and fixing it rewrites the access-level wording throughout both articles — better as its own pass.

Could not assign the docs PR. emkhalid is not a collaborator on Expensify/App, so GitHub rejects both assignment and review requests. The HelpDot label is applied and you are tagged in the PR body instead.

@emkhalid, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/lakchote in version: 9.4.91-3 🚀

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants