You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots #96225
Version Number: 9.4.34-12 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@JmillsExpensify Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Sign in to an account with more than 12 copilots.
Open the Copilot quick switcher.
Observe the available controls.
Expected Result:
The quick switcher should display a search input when there are more than 12 copilots.
Actual Result:
No search input is displayed.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
The Copilot quick switcher is rendered by AccountSwitcher.tsx, which displays the copilot/delegator list through a plain PopoverMenu (menuItems={menuItems()}).
PopoverMenu has no search/text-input capability at all — there is no shouldShowTextInput, search value, or filtering prop on the component. So the switcher can never show a search field, no matter how many copilots are in the list.
Everywhere else in the app, a selection list conditionally shows a search input once it reaches CONST.STANDARD_LIST_ITEM_LIMIT (= 12) — e.g. ApproverSelectionList.tsx:85 uses allApprovers?.length >= CONST.STANDARD_LIST_ITEM_LIMIT. The switcher was never wired up to that convention, so it's the outlier that has no way to search a long copilot list.
What changes do you think we should make in order to solve the problem?
Give the switcher a searchable list when the copilot count crosses the standard threshold. The switcher already computes the list from delegators and builds delegatorMenuItems.
Two viable approaches (implementer to pick after weighing reuse vs. blast radius):
Render the list with SelectionList inside the popover instead of passing menuItems to PopoverMenu, and set shouldShowTextInput={delegators.length >= CONST.STANDARD_LIST_ITEM_LIMIT}. This reuses the exact pattern (and 12-item threshold) already used across approver/tax/vacation-delegate pickers, giving free, consistent search + filtering behavior.
Add optional search support to PopoverMenu (a shouldShowTextInput/filter prop that renders a text input in the header and filters menuItems by text/description). Higher blast radius since PopoverMenu is widely shared, but keeps the switcher's current structure.
Approach 1 is preferred — it matches the established convention with the least new surface area.
What alternative solutions did you explore? (Optional)
Hard-coding a search box always-on in the switcher was considered, but that diverges from the app-wide behavior of only showing search past the 12-item limit, so gating on CONST.STANDARD_LIST_ITEM_LIMIT is the right call.
Investigation notes / confidence
Confirmed PopoverMenu/index.tsx exposes no search/text-input prop (grep for search/textInput returns nothing in the component).
STANDARD_LIST_ITEM_LIMIT is 12, matching the "more than 12 copilots" symptom exactly.
The fix is entirely within the App repo (src/components/AccountSwitcher.tsx, optionally PopoverMenu), so no backend/other-repo work is needed.
Confidence: Medium-High — root cause verified in code; the two fix paths are design choices for the implementer, not open questions about the cause.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/96225) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-15 22:02:12 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an account has more than 12 copilots, opening the Copilot quick switcher (the account switcher popover in the sidebar) shows only a long scrollable list of accounts with no search input. Every other long list in the app (categories, tags, workspaces, members) shows a "Search" text input once it reaches 12 items, so users with many copilots have no way to quickly find the account they want to switch to.
The issue owner has since clarified the scope (#96225 (comment)): once the threshold is met, the search input is needed in two places, the quick switcher popover and the Copilots page, covering both the accounts you can access and the members who can access your account.
What is the root cause of that problem?
The quick switcher is AccountSwitcher, and it renders its copilot list through a plain PopoverMenu:
AccountSwitcher builds the rows in menuItems() (src/components/AccountSwitcher.tsx lines 163 to 224): the current user row plus one PopoverMenuItem per entry in account.delegatedAccess.delegators, sorted with sortAlphabetically. Nothing in this component measures the list size, so the full unfiltered array is always passed down regardless of how many copilots exist.
PopoverMenu itself has no concept of a search input. BasePopoverMenu renders exactly three things inside its content container, and none of them is a text input (src/components/PopoverMenu/index.tsx):
The app-wide convention is CONST.STANDARD_LIST_ITEM_LIMIT: 12 (src/CONST/index.ts line 5196): pickers show a search input once the list reaches 12 items, for example CategoryPicker/index.tsx line 93 with shouldShowTextInput={categoriesCount >= CONST.STANDARD_LIST_ITEM_LIMIT} and DynamicNewReportWorkspaceSelectionPage.tsx line 257. That convention is implemented by SelectionList consumers and by pages that mount SearchBar above a list, but the copilot switcher never went through either path, so the threshold check simply does not exist anywhere on this code path. There is no broken condition to flip; the capability is missing from both AccountSwitcher and the PopoverMenu it uses.
I reproduced this with an account that has 13 copilots: opening the account switcher from Settings shows the 'Switch accounts:' popover with the current account's radio selected and all 13 copilot rows with their Full/Limited role badges, but no search input appears anywhere; with the popover open the document contains zero input or textarea elements and nothing carrying a search label or placeholder. The underlying account data is correct, all 13 delegators are present and render, and the console stays clean through the whole flow, so nothing throws and nothing filters; the failure is that the capability does not exist on this path. The list flows unfiltered from menuItems() in src/components/AccountSwitcher.tsx straight into PopoverMenu, whose content renders only the header text and the menu rows (src/components/PopoverMenu/index.tsx lines 723-727), and neither file references SearchBar, shouldShowTextInput, useSearchResults, or CONST.STANDARD_LIST_ITEM_LIMIT, so the 12-item search convention has no hook here.
The Copilots page has the same gap through a simpler path: src/pages/settings/Copilot/CopilotPage.tsx builds delegatorMenuItems and delegateMenuItems (lines 203 to 309) and renders each through a plain MenuItemList:
Nothing on that page measures list size or mounts a SearchBar either, so both lists grow unbounded with no way to filter them.
What changes do you think we should make in order to solve the problem?
We should reuse the existing building blocks instead of writing new search logic: the SearchBar component (src/components/SearchBar.tsx), the useSearchResults hook (src/hooks/useSearchResults.ts, which already handles debouncing and resets the input when the dataset drops back under STANDARD_LIST_ITEM_LIMIT), and tokenizedSearch (src/libs/tokenizedSearch.ts).
In AccountSwitcher, extract the delegator rows out of menuItems() into a memoized delegatorMenuItems array (the existing lines 197 to 221 unchanged), then pipe them through the hook and gate the search on the standard threshold, matching the issue's expected behavior:
The menu becomes [currentUserMenuItem, ...filteredDelegatorMenuItems], so the pinned current-user row is never filtered out and searching matches both display name and login. In PopoverMenu, add four optional props (searchInputLabel, searchInputValue, onSearchInputChange, shouldShowSearchEmptyState) and, when searchInputLabel is set, render the header plus a SearchBar above PopoverMenuContent so the input stays pinned while the list scrolls; when the props are absent, rendering is byte-for-byte identical to today, so ButtonWithDropdownMenu and every other consumer is unaffected. AccountSwitcher then passes searchInputLabel={shouldShowSearchInput ? translate('common.search') : undefined}, searchInputValue={searchInput}, onSearchInputChange={setSearchInput}, and shouldShowSearchEmptyState={shouldShowSearchInput && filteredDelegatorMenuItems.length === 0} to surface the existing "No results found" copy. One subtle but required piece: PopoverMenu is exported through React.memo with a custom comparator that only compares a fixed list of props:
If the user types a character that does not change the filtered results, deepEqual(menuItems) passes and the popover would skip the re-render, leaving the controlled TextInput stale, so searchInputValue, searchInputLabel, and shouldShowSearchEmptyState must be added to that comparator. Filtering itself needs no changes inside PopoverMenu: the existing useLayoutEffect at line 591 already syncs currentMenuItems whenever menuItems changes (the sub-menu key path is empty here), and useArrowKeyFocusManager derives maxIndex from currentMenuItems.length - 1, so arrow-key navigation and Enter keep working over the filtered rows. When acting as a delegate the menu has at most two rows and shouldShowSearchInput stays false, so that branch is untouched.
For the Copilots page the same threshold and building blocks apply, and no PopoverMenu change is involved: the page already builds its rows from sortedDelegators and sortedDelegates, where every entry carries the resolved display name (sortKey) and email. When delegators.length + delegates.length >= CONST.STANDARD_LIST_ITEM_LIMIT, render the same SearchBar below the section subtitle and filter the two source arrays with tokenizedSearch on [sortKey, email] before they are mapped to menu items; running useSearchResults over the combined array and partitioning it back into the two lists keeps its debounce and its under-limit reset. Each sub-header ('You can access these accounts' / 'Members can access your account') is hidden while its filtered list is empty, the standard no-results copy shows when both are, and the 'Add copilot' row stays outside the filter.
What specific alternative solutions were considered (if any) and why is the primary solution better? (optional)
Replacing the popover body with a SelectionList (which already implements shouldShowTextInput) was considered, but no compact anchored popover in the app hosts a SelectionList, and the switcher relies on PopoverMenu/MenuItem behavior it would lose or have to reimplement: radio-button mode, per-row badgeText for the copilot role, per-row errorText with red dot indicators via OfflineWithFeedback, and the measured-content anchoring. Extending PopoverMenu with an optional pinned SearchBar is a much smaller, opt-in change that reuses the exact search pattern already shipped in SpendRuleSelectionPage and WorkspaceWorkflowsPage.
What automated tests can be added to prevent regression? (optional)
A React Native Testing Library test alongside the existing delegate tests (tests/unit/DelegateAccessHandlerTest.tsx) that renders AccountSwitcher with account.delegatedAccess.delegators seeded with 12+ entries in Onyx, opens the switcher, and asserts the search input is present; typing a query should narrow the visible rows to matching copilots plus the current-user row, and a second case with fewer than 12 delegators should assert the input is absent. For the Copilots page, a similar test seeding 12 or more combined delegates and delegators should assert the search input renders, that a query narrows both lists by name and email, and that the input is absent below the threshold.
Please re-state the problem that we are trying to solve in this issue.
On Web/Desktop, when a user with more than 12 copilots opens the Copilot quick switcher (the AccountSwitcher popover in the sidebar), no search input is rendered, forcing the user to scroll through the entire delegator list. The expected behavior is that the popover exposes a search input once the delegator list crosses a size threshold (>12) so the user can filter copilots quickly.
What is the root cause of that problem?
AccountSwitcher (src/components/AccountSwitcher.tsx:299-320) renders PopoverMenu with the full menuItems() list and never provides a search/filter affordance. menuItems() (src/components/AccountSwitcher.tsx:163-224) builds one PopoverMenuItem per delegator via sortAlphabetically(...) on lines 197-221 with no truncation or filtering — every copilot is passed straight into the popover. The PopoverMenu component itself (src/components/PopoverMenu/index.tsx) has no searchValue/shouldShowSearchInput prop, so nothing downstream can inject a search box either. The result: regardless of delegator count, the switcher shows an unfiltered scroll list only.
What changes do you think we should make in order to solve the problem?
In src/components/AccountSwitcher.tsx add local searchValue state (reset on hideDelegatorMenu) and, when delegators.length > CONST.COPILOT_SEARCH_INPUT_THRESHOLD (new constant = 12), filter the delegatorMenuItems in menuItems() (lines 197-221) by matching searchValue against each delegator's displayName/login (using formatPhoneNumber + Str.removeSMSDomain) before passing to PopoverMenu.
Render a TextInput (search field) inside the popover for the >12-copilots case. Options: (a) extend PopoverMenu (src/components/PopoverMenu/index.tsx) with a new shouldShowSearchInput/searchValue/onChangeSearchValue/searchInputPlaceholder prop set that renders a sticky header TextInput above the menu list; or (b) wrap the popover contents in a custom header via existing header slots. Prefer (a) so other call sites can reuse it.
Add the new translation key delegate.searchCopilots (or reuse common.search) for the input placeholder in src/languages/*.
Ensure the delegator's email is included in the searchable text so users can find copilots by login when the display name is empty.
Keep shouldUseScrollView and the existing maxHeight: windowHeight / 2 so the input remains sticky while results scroll (line 312).
What alternative solutions did you explore? (Optional)
Please re-state the problem that we are trying to solve in this issue.
When a user has more than 12 copilots, the Copilot quick switcher (the account switcher popover) shows the full list with no search input, so there is no way to filter and find a specific copilot.
What is the root cause of that problem?
The copilot quick switcher is rendered by AccountSwitcher, which builds the copilot/delegator rows in menuItems() and hands them to a plain PopoverMenu:
PopoverMenu has no search/filter TextInput at all (zero references to search/text-input/filter in src/components/PopoverMenu/index.tsx). Every other long list in the app instead gates a search box on the shared threshold CONST.STANDARD_LIST_ITEM_LIMIT (= 12), e.g. shouldShowTextInput={count >= CONST.STANDARD_LIST_ITEM_LIMIT} in the category/tag/approver pickers:
Because the switcher never opts into that pattern, once the list crosses the 12-item threshold it stays unfilterable.
What changes do you think we should make in order to solve the problem?
Show a filter TextInput in the copilot switcher when the copilot count reaches the standard threshold, matching the rest of the app. Gate it on the same constant and filter menuItems() by the typed value:
const shouldShowSearchInput = delegators.length >= CONST.STANDARD_LIST_ITEM_LIMIT;
// render a TextInput above the list when shouldShowSearchInput,
// and filter delegatorMenuItems by display name / login on the search value
This can live in AccountSwitcher (filtering menuItems() before passing to PopoverMenu) or by adding a search-input capability to PopoverMenu; the AccountSwitcher-local filter is the smaller, lower-risk change. Regression risk is limited to the switcher popover — lists of ≤11 copilots are unaffected since the input only appears at/above the existing 12-item threshold.
The copilot quick switcher renders its account list through the legacy PopoverMenu (v1), whose public API is a closed array-of-config: AccountSwitcher builds plain data objects in menuItems() and hands them over as menuItems={menuItems()}.
The reason no search input can appear is not simply "the feature was never written" — it's that v1's contract has no seam to put one in. The caller cannot hand v1 arbitrary content; it can only hand it row descriptors, and v1 renders exactly a header plus those rows:
That closed shape is precisely the problem the repo has already solved: PopoverMenu/v2 is a compound, Radix-style primitive set where the caller composes the popover's contents, and it explicitly supports caller-supplied non-row content inside <Content> via useIsAtActiveLevel():
Hook for self-gating custom (non-row) content rendered directly inside `<Content>` or `<Sub.Content>`. Returns `true` when the enclosing `<Sub>`'s id is the current sub-level (or when the consumer is at the top level and no sub is active). Custom content should render `null` when this is `false` so siblings at other levels don't show through. Requires `<Content>`; `<Sub>` is optional (top-level use returns `true` when no sub is active).
v2 is not a sketch — it is exported and already used in production by the video player menu:
So the root cause is that the switcher sits on the legacy closed API while the composable replacement that makes a search field expressible already exists. Nothing ever compares the delegator count to CONST.STANDARD_LIST_ITEM_LIMIT (12) because, on v1, there is nowhere for the resulting input to go:
What changes do you think we should make in order to solve the problem?
Migrate AccountSwitcher to PopoverMenu v2 and compose the search field, instead of bolting search props onto v1.
Replace the single <PopoverMenu menuItems={menuItems()} /> call site with the v2 compound tree: <Root> / <Trigger> wrapping the existing PressableWithFeedback, <ScrollableContent> for the capped list, <Header> for delegate.switchAccount, and one <RadioItem> per account. <RadioItem> already covers everything createBaseMenuItem produces today — it renders MenuItem and wraps it in OfflineWithFeedback:
and MenuItemForwardProps passes through the rest of MenuItemProps, so badgeText (the role badge), icon/iconType/avatarID, description, errorText, and shouldShowRedDotIndicator all survive the move unchanged:
The search field then becomes ordinary composed content — a small CopilotSearchInput rendered as the first child of <ScrollableContent>, self-gating on useIsAtActiveLevel() per the v2 contract, holding searchValue locally, and gated on the standard threshold:
Filtering is just not rendering the non-matching <RadioItem> children (match on display name + login, keeping the current-user row pinned), and the no-results case is a <Label> row.
Two concrete correctness wins that fall out of this and are not available on v1:
Keyboard navigation stays correct for free. v2's focus registry is keyed by row ID and derives order from the actually-mounted rows, so filtered-out rows unregister and the arrow-key order re-derives itself:
On v1, focusedIndex is an index into a static array, so any filtering approach has to manually re-sync focus on every keystroke or the highlight silently points at the wrong copilot.
No new prop on a hand-maintained memo allowlist. v1 is wrapped in a React.memo whose comparator enumerates props explicitly — any new search prop is invisible to it unless the comparator is also edited, which is an easy stale-callback trap for every future caller:
Scope is one call site plus one small input component; v1 keeps its exact current API, so none of its many other callers are touched at all. Note <ScrollableContent> renders children inside a ScrollView, so keeping the input pinned while results scroll wants stickyHeaderIndices on that ScrollView — a contained addition to ScrollableContent. v2 requires Fabric, which the app already runs.
What alternative solutions did you explore? (Optional)
Add opt-in search props (shouldShowTextInput / searchValue / onChangeSearchValue) to the shared v1 PopoverMenu. This widens the API of a heavily-shared legacy component for one caller, forces the manual focusedIndex re-sync described above, and requires editing the memo comparator in lockstep — all to add a capability v2 already expresses by composition. It also pushes new investment into the component v2 is meant to replace.
Keep the filtering entirely local to AccountSwitcher and render a TextInput above the popover. The input then lives outside the popover surface rather than inside it, and it still inherits v1's stale focusedIndex problem.
Swap the popover's contents for a SelectionList with shouldShowTextInput. Reuses standard search/empty-state behaviour outright, but rewrites the switcher's radio rows, role badges, offline error dots, and GPS-confirmation flow for a single caller.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-31 13:38:42 UTC.
Proposal
What is the root cause of that problem?
When someone has 12+ copilots and opens the Switch accounts popover, they only get a long scrollable list. There is no Find member field, so filtering by name/email is not possible. The same gap shows up on the Copilots settings page once the combined to/from list gets long.
The quick switcher lives in AccountSwitcher and always feeds a plain PopoverMenu with menuItems():
PopoverMenu itself can only render the header text, optional back row, and menu rows inside its scroll content. There is no slot for caller-owned content above the rows:
So even if AccountSwitcher wanted a SearchBar, the shared menu has nowhere to put it without scrolling the input away with the list.
The Copilots page has the same kind of gap on a simpler path. It builds delegatorMenuItems / delegateMenuItems and renders both through MenuItemList with no size check and no filter:
Jmills also clarified we need search in both places once the threshold is hit: quick switcher at 12+ copilots you can access, and Copilots page when the combined access to/from count is 12+.
What changes do you think we should make in order to solve the problem?
Reuse existing search helpers (SearchBar, useSearchResults, tokenizedSearch) and keep the switcher on PopoverMenu, but give the menu a generic place for pinned chrome.
In PopoverMenu, add an optional aboveListContent ReactNode. At the root menu only, render it under the header. When shouldUseScrollView is on, keep the header + that content outside the ScrollView so the search field stays pinned while rows scroll. Also exclude INPUT from Enter capture so typing Enter in the field does not select a row, clamp focused index when filtering shrinks the list, and include aboveListContent in the custom memo comparator:
When the prop is omitted, rendering stays the same as today for every other caller.
In AccountSwitcher, build the delegator rows separately, then put current user + delegators through useSearchResults + tokenizedSearch on display name and login. Show search when delegatorMenuItems.length >= CONST.STANDARD_LIST_ITEM_LIMIT and the user is not acting as a delegate:
Pass a Find member SearchBar via aboveListContent (label: workspace.people.findMember), with shouldShowIcon={false} so it matches the no-icon Find member look used by table filter bars. Clear the query in hideDelegatorMenu. Important detail: include the current-user row in the searchable set, so searching does not leave the selected account stuck on screen when it does not match.
On CopilotPage, combine displayed delegators + delegates (skip optimistic delegate placeholders) into one tagged list. Gate one Find member SearchBar on the combined count >= CONST.STANDARD_LIST_ITEM_LIMIT, filter with tokenizedSearch, then split results back into the two sections. Hide a section when it has no matches, show the empty state when both are empty, keep Add copilot outside the filter:
Small SearchBar tweak: optional shouldShowIcon (default true) so Copilot can hide the magnifying glass without changing other SearchBar callers. Domain members / categories already look like this via Table.FilterBar, which never passes an icon.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Note — how this proposal differs from the existing ones on this issue:
It does not modify the legacy PopoverMenu at all — unlike the proposals that add search props to it (which require editing its hand-maintained React.memo comparator, re-syncing its index-based arrow-key focus on every keystroke, and scoping the filter away from sub-menus).
It does not migrate the switcher to PopoverMenu v2.
Its switcher solution is grounded in a production precedent no other proposal cites: CategoryPickerModal already renders a threshold-searchable SelectionList inside PopoverWithMeasuredContent — which directly refutes the objection that "no compact anchored popover in the app hosts a SelectionList".
It covers both surfaces from the scope clarification (quick switcher + Copilots page) with the exact thresholds stated there: delegators >= 12 for the switcher, and the combined to/from count >= 12 for the Copilots page — matching the single "Find member" field shown in the design screenshots.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Per the issue and the scope clarification in #96225 (comment), a "Find member" quick search filter must appear in two places once the 12-copilot threshold is met:
The Copilot quick switcher (the "Switch accounts:" popover) — when the user can access at least 12 copilot accounts.
The Copilots page — when there are 12 or more copilots with access to/from other accounts (both sections combined).
Today neither surface ever shows a search input, no matter how long the lists get.
What is the root cause of that problem?
The two surfaces render their lists through components that have no search capability, and neither applies the app-wide CONST.STANDARD_LIST_ITEM_LIMIT (= 12) convention:
The quick switcher (AccountSwitcher) builds its rows in menuItems() and hands the full unfiltered array to the legacy PopoverMenu:
The 12-item search convention lives in SelectionList consumers (e.g. CategoryPicker/index.tsx gates shouldShowTextInput on categoriesCount >= CONST.STANDARD_LIST_ITEM_LIMIT), and neither copilot surface is on that path:
What changes do you think we should make in order to solve the problem?
Reuse the two search patterns that already ship in production, one per surface, with zero changes to the shared PopoverMenu.
Surface 1 — quick switcher: reuse the anchored-popover + SelectionList pattern that CategoryPickerModal already ships.
The main objection raised against a SelectionList here is that "no compact anchored popover in the app hosts a SelectionList" — but one does, in production: CategoryPickerModal renders the threshold-searchable category picker inside PopoverWithMeasuredContent:
Apply the same pattern to the switcher: keep the existing trigger, anchor position, and maxHeight: windowHeight / 2 cap, and render the account list with a SelectionList inside PopoverWithMeasuredContent instead of PopoverMenu:
Map the same rows menuItems() builds today (pinned current-user radio row + alphabetized delegators with avatar, Full/Limited role badge, and connect-error red dot) onto the shared list-item model.
Gate the input on the clarified threshold: shouldShowTextInput={delegators.length >= CONST.STANDARD_LIST_ITEM_LIMIT}, with textInputOptions using the existing workspace.people.findMember ("Find member") string from the design, filtering by display name + login via tokenizedSearch, and the standard common.noResultsFound header message.
Move the existing onSelected behavior (connect/disconnect, offline modal, GPS-in-progress confirmation) into onSelectRow unchanged. The acting-as-delegate branch (max 2 rows) never reaches the threshold and stays as-is. The query resets naturally because the popover content unmounts on close.
This gets search, filtering, empty state, and keyboard navigation over the filtered list for free from SelectionList, and leaves PopoverMenu byte-for-byte untouched for its many other consumers — no new props, no edits to its hand-maintained React.memo comparator (L735–L754), and no manual re-syncing of its index-based arrow-key focus while filtering.
Surface 2 — Copilots page: one combined "Find member" SearchBar.
The page already builds sortedDelegators (L270–274) and sortedDelegates (L204–208, which already excludes optimistic placeholders). Combine both into one tagged collection and pipe it through the existing useSearchResults hook (debounce + auto-reset below the limit built in, L36–L41) with tokenizedSearch on display name + email:
Show a single SearchBar (label: workspace.people.findMember, matching the design screenshots) when sortedDelegators.length + sortedDelegates.length >= CONST.STANDARD_LIST_ITEM_LIMIT — the "access to/from other accounts" combined threshold from the scope comment.
Partition the filtered results back into the two existing sections; hide a section header while its filtered list is empty; show the standard no-results state when both are; keep the "Add copilot" row outside the filter.
Frontend-only; no Onyx shape, API, or navigation changes.
How this differs from the other proposals on this issue: it changes neither the legacy PopoverMenu (no new search props, no memo-comparator edits, no focus-index re-syncing) nor migrates to PopoverMenu v2 — it reuses the already-shipping CategoryPickerModal anchored-SelectionList precedent for the switcher, and covers the clarified second surface with the standard SearchBar + useSearchResults idiom.
changed the title [-]Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]on Jul 15, 2026
changed the title [-][Due for payment 2026-09-30] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]on Nov 16, 2026
changed the title [-][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][Due for payment 2026-11-28] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]on Nov 21, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.51-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-11-28. 🎊
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]
changed the title [-][Due for payment 2026-11-28] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]on Nov 21, 2026
Activity
MelvinBot commentedon Jul 15, 2026
Proposal
What is the root cause of that problem?
The Copilot quick switcher is rendered by
AccountSwitcher.tsx, which displays the copilot/delegator list through a plainPopoverMenu(menuItems={menuItems()}).PopoverMenuhas no search/text-input capability at all — there is noshouldShowTextInput, search value, or filtering prop on the component. So the switcher can never show a search field, no matter how many copilots are in the list.Everywhere else in the app, a selection list conditionally shows a search input once it reaches
CONST.STANDARD_LIST_ITEM_LIMIT(= 12) — e.g.ApproverSelectionList.tsx:85usesallApprovers?.length >= CONST.STANDARD_LIST_ITEM_LIMIT. The switcher was never wired up to that convention, so it's the outlier that has no way to search a long copilot list.What changes do you think we should make in order to solve the problem?
Give the switcher a searchable list when the copilot count crosses the standard threshold. The switcher already computes the list from
delegatorsand buildsdelegatorMenuItems.Two viable approaches (implementer to pick after weighing reuse vs. blast radius):
SelectionListinside the popover instead of passingmenuItemstoPopoverMenu, and setshouldShowTextInput={delegators.length >= CONST.STANDARD_LIST_ITEM_LIMIT}. This reuses the exact pattern (and 12-item threshold) already used across approver/tax/vacation-delegate pickers, giving free, consistent search + filtering behavior.PopoverMenu(ashouldShowTextInput/filter prop that renders a text input in the header and filtersmenuItemsby text/description). Higher blast radius sincePopoverMenuis widely shared, but keeps the switcher's current structure.Approach 1 is preferred — it matches the established convention with the least new surface area.
What alternative solutions did you explore? (Optional)
Hard-coding a search box always-on in the switcher was considered, but that diverges from the app-wide behavior of only showing search past the 12-item limit, so gating on
CONST.STANDARD_LIST_ITEM_LIMITis the right call.Investigation notes / confidence
PopoverMenu/index.tsxexposes no search/text-input prop (grep forsearch/textInputreturns nothing in the component).STANDARD_LIST_ITEM_LIMITis12, matching the "more than 12 copilots" symptom exactly.src/components/AccountSwitcher.tsx, optionallyPopoverMenu), so no backend/other-repo work is needed.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/96225)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
MobileMage commentedon Jul 15, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-15 22:02:12 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an account has more than 12 copilots, opening the Copilot quick switcher (the account switcher popover in the sidebar) shows only a long scrollable list of accounts with no search input. Every other long list in the app (categories, tags, workspaces, members) shows a "Search" text input once it reaches 12 items, so users with many copilots have no way to quickly find the account they want to switch to.
The issue owner has since clarified the scope (#96225 (comment)): once the threshold is met, the search input is needed in two places, the quick switcher popover and the Copilots page, covering both the accounts you can access and the members who can access your account.
What is the root cause of that problem?
The quick switcher is
AccountSwitcher, and it renders its copilot list through a plainPopoverMenu:App/src/components/AccountSwitcher.tsx
Lines 299 to 303 in c81c4b7
AccountSwitcherbuilds the rows inmenuItems()(src/components/AccountSwitcher.tsxlines 163 to 224): the current user row plus onePopoverMenuItemper entry inaccount.delegatedAccess.delegators, sorted withsortAlphabetically. Nothing in this component measures the list size, so the full unfiltered array is always passed down regardless of how many copilots exist.PopoverMenuitself has no concept of a search input.BasePopoverMenurenders exactly three things inside its content container, and none of them is a text input (src/components/PopoverMenu/index.tsx):App/src/components/PopoverMenu/index.tsx
Lines 723 to 727 in c81c4b7
The app-wide convention is
CONST.STANDARD_LIST_ITEM_LIMIT: 12(src/CONST/index.tsline 5196): pickers show a search input once the list reaches 12 items, for exampleCategoryPicker/index.tsxline 93 withshouldShowTextInput={categoriesCount >= CONST.STANDARD_LIST_ITEM_LIMIT}andDynamicNewReportWorkspaceSelectionPage.tsxline 257. That convention is implemented bySelectionListconsumers and by pages that mountSearchBarabove a list, but the copilot switcher never went through either path, so the threshold check simply does not exist anywhere on this code path. There is no broken condition to flip; the capability is missing from bothAccountSwitcherand thePopoverMenuit uses.I reproduced this with an account that has 13 copilots: opening the account switcher from Settings shows the 'Switch accounts:' popover with the current account's radio selected and all 13 copilot rows with their Full/Limited role badges, but no search input appears anywhere; with the popover open the document contains zero input or textarea elements and nothing carrying a search label or placeholder. The underlying account data is correct, all 13 delegators are present and render, and the console stays clean through the whole flow, so nothing throws and nothing filters; the failure is that the capability does not exist on this path. The list flows unfiltered from menuItems() in src/components/AccountSwitcher.tsx straight into PopoverMenu, whose content renders only the header text and the menu rows (src/components/PopoverMenu/index.tsx lines 723-727), and neither file references SearchBar, shouldShowTextInput, useSearchResults, or CONST.STANDARD_LIST_ITEM_LIMIT, so the 12-item search convention has no hook here.
The Copilots page has the same gap through a simpler path:
src/pages/settings/Copilot/CopilotPage.tsxbuildsdelegatorMenuItemsanddelegateMenuItems(lines 203 to 309) and renders each through a plainMenuItemList:App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 446 to 457 in c81c4b7
Nothing on that page measures list size or mounts a
SearchBareither, so both lists grow unbounded with no way to filter them.What changes do you think we should make in order to solve the problem?
We should reuse the existing building blocks instead of writing new search logic: the
SearchBarcomponent (src/components/SearchBar.tsx), theuseSearchResultshook (src/hooks/useSearchResults.ts, which already handles debouncing and resets the input when the dataset drops back underSTANDARD_LIST_ITEM_LIMIT), andtokenizedSearch(src/libs/tokenizedSearch.ts).In
AccountSwitcher, extract the delegator rows out ofmenuItems()into a memoizeddelegatorMenuItemsarray (the existing lines 197 to 221 unchanged), then pipe them through the hook and gate the search on the standard threshold, matching the issue's expected behavior:The menu becomes
[currentUserMenuItem, ...filteredDelegatorMenuItems], so the pinned current-user row is never filtered out and searching matches both display name and login. InPopoverMenu, add four optional props (searchInputLabel,searchInputValue,onSearchInputChange,shouldShowSearchEmptyState) and, whensearchInputLabelis set, render the header plus aSearchBarabovePopoverMenuContentso the input stays pinned while the list scrolls; when the props are absent, rendering is byte-for-byte identical to today, soButtonWithDropdownMenuand every other consumer is unaffected.AccountSwitcherthen passessearchInputLabel={shouldShowSearchInput ? translate('common.search') : undefined},searchInputValue={searchInput},onSearchInputChange={setSearchInput}, andshouldShowSearchEmptyState={shouldShowSearchInput && filteredDelegatorMenuItems.length === 0}to surface the existing "No results found" copy. One subtle but required piece:PopoverMenuis exported throughReact.memowith a custom comparator that only compares a fixed list of props:App/src/components/PopoverMenu/index.tsx
Lines 735 to 739 in c81c4b7
If the user types a character that does not change the filtered results,
deepEqual(menuItems)passes and the popover would skip the re-render, leaving the controlledTextInputstale, sosearchInputValue,searchInputLabel, andshouldShowSearchEmptyStatemust be added to that comparator. Filtering itself needs no changes insidePopoverMenu: the existinguseLayoutEffectat line 591 already syncscurrentMenuItemswhenevermenuItemschanges (the sub-menu key path is empty here), anduseArrowKeyFocusManagerderivesmaxIndexfromcurrentMenuItems.length - 1, so arrow-key navigation and Enter keep working over the filtered rows. When acting as a delegate the menu has at most two rows andshouldShowSearchInputstays false, so that branch is untouched.For the Copilots page the same threshold and building blocks apply, and no
PopoverMenuchange is involved: the page already builds its rows fromsortedDelegatorsandsortedDelegates, where every entry carries the resolved display name (sortKey) andemail. Whendelegators.length + delegates.length >= CONST.STANDARD_LIST_ITEM_LIMIT, render the sameSearchBarbelow the section subtitle and filter the two source arrays withtokenizedSearchon[sortKey, email]before they are mapped to menu items; runninguseSearchResultsover the combined array and partitioning it back into the two lists keeps its debounce and its under-limit reset. Each sub-header ('You can access these accounts' / 'Members can access your account') is hidden while its filtered list is empty, the standard no-results copy shows when both are, and the 'Add copilot' row stays outside the filter.What specific alternative solutions were considered (if any) and why is the primary solution better? (optional)
Replacing the popover body with a
SelectionList(which already implementsshouldShowTextInput) was considered, but no compact anchored popover in the app hosts aSelectionList, and the switcher relies onPopoverMenu/MenuItembehavior it would lose or have to reimplement: radio-button mode, per-rowbadgeTextfor the copilot role, per-rowerrorTextwith red dot indicators viaOfflineWithFeedback, and the measured-content anchoring. ExtendingPopoverMenuwith an optional pinnedSearchBaris a much smaller, opt-in change that reuses the exact search pattern already shipped inSpendRuleSelectionPageandWorkspaceWorkflowsPage.What automated tests can be added to prevent regression? (optional)
A React Native Testing Library test alongside the existing delegate tests (
tests/unit/DelegateAccessHandlerTest.tsx) that rendersAccountSwitcherwithaccount.delegatedAccess.delegatorsseeded with 12+ entries in Onyx, opens the switcher, and asserts the search input is present; typing a query should narrow the visible rows to matching copilots plus the current-user row, and a second case with fewer than 12 delegators should assert the input is absent. For the Copilots page, a similar test seeding 12 or more combined delegates and delegators should assert the search input renders, that a query narrows both lists by name and email, and that the input is absent below the threshold.aswin-s commentedon Jul 15, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web/Desktop, when a user with more than 12 copilots opens the Copilot quick switcher (the AccountSwitcher popover in the sidebar), no search input is rendered, forcing the user to scroll through the entire delegator list. The expected behavior is that the popover exposes a search input once the delegator list crosses a size threshold (>12) so the user can filter copilots quickly.
What is the root cause of that problem?
AccountSwitcher(src/components/AccountSwitcher.tsx:299-320) rendersPopoverMenuwith the fullmenuItems()list and never provides a search/filter affordance.menuItems()(src/components/AccountSwitcher.tsx:163-224) builds onePopoverMenuItemper delegator viasortAlphabetically(...)on lines 197-221 with no truncation or filtering — every copilot is passed straight into the popover. ThePopoverMenucomponent itself (src/components/PopoverMenu/index.tsx) has nosearchValue/shouldShowSearchInputprop, so nothing downstream can inject a search box either. The result: regardless of delegator count, the switcher shows an unfiltered scroll list only.What changes do you think we should make in order to solve the problem?
src/components/AccountSwitcher.tsxadd localsearchValuestate (reset onhideDelegatorMenu) and, whendelegators.length > CONST.COPILOT_SEARCH_INPUT_THRESHOLD(new constant = 12), filter thedelegatorMenuItemsinmenuItems()(lines 197-221) by matchingsearchValueagainst each delegator'sdisplayName/login(usingformatPhoneNumber+Str.removeSMSDomain) before passing toPopoverMenu.TextInput(search field) inside the popover for the >12-copilots case. Options: (a) extendPopoverMenu(src/components/PopoverMenu/index.tsx) with a newshouldShowSearchInput/searchValue/onChangeSearchValue/searchInputPlaceholderprop set that renders a sticky headerTextInputabove the menu list; or (b) wrap the popover contents in a custom header via existing header slots. Prefer (a) so other call sites can reuse it.delegate.searchCopilots(or reusecommon.search) for the input placeholder insrc/languages/*.emailis included in the searchable text so users can find copilots by login when the display name is empty.shouldUseScrollViewand the existingmaxHeight: windowHeight / 2so the input remains sticky while results scroll (line 312).What alternative solutions did you explore? (Optional)
ahmdshrif commentedon Jul 15, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user has more than 12 copilots, the Copilot quick switcher (the account switcher popover) shows the full list with no search input, so there is no way to filter and find a specific copilot.
What is the root cause of that problem?
The copilot quick switcher is rendered by
AccountSwitcher, which builds the copilot/delegator rows inmenuItems()and hands them to a plainPopoverMenu:App/src/components/AccountSwitcher.tsx
Lines 300 to 311 in c81c4b7
App/src/components/AccountSwitcher.tsx
Lines 163 to 224 in c81c4b7
PopoverMenuhas no search/filter TextInput at all (zero references to search/text-input/filter insrc/components/PopoverMenu/index.tsx). Every other long list in the app instead gates a search box on the shared thresholdCONST.STANDARD_LIST_ITEM_LIMIT(= 12), e.g.shouldShowTextInput={count >= CONST.STANDARD_LIST_ITEM_LIMIT}in the category/tag/approver pickers:App/src/CONST/index.ts
Line 5196 in c81c4b7
Because the switcher never opts into that pattern, once the list crosses the 12-item threshold it stays unfilterable.
What changes do you think we should make in order to solve the problem?
Show a filter TextInput in the copilot switcher when the copilot count reaches the standard threshold, matching the rest of the app. Gate it on the same constant and filter
menuItems()by the typed value:This can live in
AccountSwitcher(filteringmenuItems()before passing toPopoverMenu) or by adding a search-input capability toPopoverMenu; theAccountSwitcher-local filter is the smaller, lower-risk change. Regression risk is limited to the switcher popover — lists of ≤11 copilots are unaffected since the input only appears at/above the existing 12-item threshold.lorretheboy commentedon Jul 15, 2026
Proposal
What is the root cause of that problem?
The copilot quick switcher renders its account list through the legacy
PopoverMenu(v1), whose public API is a closed array-of-config:AccountSwitcherbuilds plain data objects inmenuItems()and hands them over asmenuItems={menuItems()}.App/src/components/AccountSwitcher.tsx
Lines 299 to 319 in c81c4b7
The reason no search input can appear is not simply "the feature was never written" — it's that v1's contract has no seam to put one in. The caller cannot hand v1 arbitrary content; it can only hand it row descriptors, and v1 renders exactly a header plus those rows:
App/src/components/PopoverMenu/index.tsx
Lines 719 to 727 in c81c4b7
That closed shape is precisely the problem the repo has already solved:
PopoverMenu/v2is a compound, Radix-style primitive set where the caller composes the popover's contents, and it explicitly supports caller-supplied non-row content inside<Content>viauseIsAtActiveLevel():App/src/components/PopoverMenu/v2/README.md
Lines 91 to 93 in c81c4b7
v2 is not a sketch — it is exported and already used in production by the video player menu:
https://github.com/Expensify/App/blob/c81c4b77f18063b8837200f6fb54428d570b4ed6/src/components/PopoverMenu/v2/index.tsx
https://github.com/Expensify/App/blob/c81c4b77f18063b8837200f6fb54428d570b4ed6/src/components/VideoPopoverMenu/index.tsx
So the root cause is that the switcher sits on the legacy closed API while the composable replacement that makes a search field expressible already exists. Nothing ever compares the delegator count to
CONST.STANDARD_LIST_ITEM_LIMIT(12) because, on v1, there is nowhere for the resulting input to go:App/src/CONST/index.ts
Line 5196 in c81c4b7
What changes do you think we should make in order to solve the problem?
Migrate
AccountSwitchertoPopoverMenuv2 and compose the search field, instead of bolting search props onto v1.Replace the single
<PopoverMenu menuItems={menuItems()} />call site with the v2 compound tree:<Root>/<Trigger>wrapping the existingPressableWithFeedback,<ScrollableContent>for the capped list,<Header>fordelegate.switchAccount, and one<RadioItem>per account.<RadioItem>already covers everythingcreateBaseMenuItemproduces today — it rendersMenuItemand wraps it inOfflineWithFeedback:App/src/components/PopoverMenu/v2/rows/RadioItem.tsx
Lines 37 to 75 in c81c4b7
and
MenuItemForwardPropspasses through the rest ofMenuItemProps, sobadgeText(the role badge),icon/iconType/avatarID,description,errorText, andshouldShowRedDotIndicatorall survive the move unchanged:App/src/components/PopoverMenu/v2/rows/types.ts
Lines 6 to 22 in c81c4b7
The search field then becomes ordinary composed content — a small
CopilotSearchInputrendered as the first child of<ScrollableContent>, self-gating onuseIsAtActiveLevel()per the v2 contract, holdingsearchValuelocally, and gated on the standard threshold:Filtering is just not rendering the non-matching
<RadioItem>children (match on display name + login, keeping the current-user row pinned), and the no-results case is a<Label>row.Two concrete correctness wins that fall out of this and are not available on v1:
App/src/components/PopoverMenu/v2/content/useFocusableRegistry.ts
Lines 24 to 30 in c81c4b7
On v1,
focusedIndexis an index into a static array, so any filtering approach has to manually re-sync focus on every keystroke or the highlight silently points at the wrong copilot.React.memowhose comparator enumerates props explicitly — any new search prop is invisible to it unless the comparator is also edited, which is an easy stale-callback trap for every future caller:App/src/components/PopoverMenu/index.tsx
Lines 733 to 753 in c81c4b7
Scope is one call site plus one small input component; v1 keeps its exact current API, so none of its many other callers are touched at all. Note
<ScrollableContent>renders children inside aScrollView, so keeping the input pinned while results scroll wantsstickyHeaderIndiceson thatScrollView— a contained addition toScrollableContent. v2 requires Fabric, which the app already runs.What alternative solutions did you explore? (Optional)
shouldShowTextInput/searchValue/onChangeSearchValue) to the shared v1PopoverMenu. This widens the API of a heavily-shared legacy component for one caller, forces the manualfocusedIndexre-sync described above, and requires editing the memo comparator in lockstep — all to add a capability v2 already expresses by composition. It also pushes new investment into the component v2 is meant to replace.AccountSwitcherand render aTextInputabove the popover. The input then lives outside the popover surface rather than inside it, and it still inherits v1's stalefocusedIndexproblem.SelectionListwithshouldShowTextInput. Reuses standard search/empty-state behaviour outright, but rewrites the switcher's radio rows, role badges, offline error dots, and GPS-confirmation flow for a single caller.samranahm commentedon Jul 15, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-31 13:38:42 UTC.
Proposal
What is the root cause of that problem?
When someone has 12+ copilots and opens the Switch accounts popover, they only get a long scrollable list. There is no Find member field, so filtering by name/email is not possible. The same gap shows up on the Copilots settings page once the combined to/from list gets long.
The quick switcher lives in
AccountSwitcherand always feeds a plainPopoverMenuwithmenuItems():App/src/components/AccountSwitcher.tsx
Lines 328 to 347 in 0c1d8fe
That path never checks
CONST.STANDARD_LIST_ITEM_LIMIT(12), and never mounts a search field:App/src/CONST/index.ts
Line 5236 in 0c1d8fe
PopoverMenuitself can only render the header text, optional back row, and menu rows inside its scroll content. There is no slot for caller-owned content above the rows:App/src/components/PopoverMenu/index.tsx
Lines 719 to 727 in 0c1d8fe
So even if
AccountSwitcherwanted a SearchBar, the shared menu has nowhere to put it without scrolling the input away with the list.The Copilots page has the same kind of gap on a simpler path. It builds
delegatorMenuItems/delegateMenuItemsand renders both throughMenuItemListwith no size check and no filter:App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 446 to 457 in 0c1d8fe
Jmills also clarified we need search in both places once the threshold is hit: quick switcher at 12+ copilots you can access, and Copilots page when the combined access to/from count is 12+.
What changes do you think we should make in order to solve the problem?
Reuse existing search helpers (
SearchBar,useSearchResults,tokenizedSearch) and keep the switcher onPopoverMenu, but give the menu a generic place for pinned chrome.PopoverMenu, add an optionalaboveListContentReactNode. At the root menu only, render it under the header. WhenshouldUseScrollViewis on, keep the header + that content outside the ScrollView so the search field stays pinned while rows scroll. Also excludeINPUTfrom Enter capture so typing Enter in the field does not select a row, clamp focused index when filtering shrinks the list, and includeaboveListContentin the custom memo comparator:App/src/components/PopoverMenu/index.tsx
Lines 103 to 208 in 0c1d8fe
App/src/components/PopoverMenu/index.tsx
Lines 735 to 754 in 0c1d8fe
When the prop is omitted, rendering stays the same as today for every other caller.
AccountSwitcher, build the delegator rows separately, then put current user + delegators throughuseSearchResults+tokenizedSearchon display name and login. Show search whendelegatorMenuItems.length >= CONST.STANDARD_LIST_ITEM_LIMITand the user is not acting as a delegate:App/src/components/AccountSwitcher.tsx
Lines 198 to 258 in 0c1d8fe
Pass a Find member
SearchBarviaaboveListContent(label:workspace.people.findMember), withshouldShowIcon={false}so it matches the no-icon Find member look used by table filter bars. Clear the query inhideDelegatorMenu. Important detail: include the current-user row in the searchable set, so searching does not leave the selected account stuck on screen when it does not match.Rough shape:
CopilotPage, combine displayed delegators + delegates (skip optimistic delegate placeholders) into one tagged list. Gate one Find memberSearchBaron the combined count>= CONST.STANDARD_LIST_ITEM_LIMIT, filter withtokenizedSearch, then split results back into the two sections. Hide a section when it has no matches, show the empty state when both are empty, keep Add copilot outside the filter:App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 203 to 309 in 0c1d8fe
App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 446 to 457 in 0c1d8fe
SearchBartweak: optionalshouldShowIcon(defaulttrue) so Copilot can hide the magnifying glass without changing other SearchBar callers. Domain members / categories already look like this viaTable.FilterBar, which never passes an icon.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Test Branch
https://github.com/Expensify/App/compare/main...samranahm:96225-copilot-search-above-list-content?expand=1
Solution Verification Result
Kapture.2026-07-31.at.18.26.46.mp4
abbasifaizan70 commentedon Jul 15, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Per the issue and the scope clarification in #96225 (comment), a "Find member" quick search filter must appear in two places once the 12-copilot threshold is met:
Today neither surface ever shows a search input, no matter how long the lists get.
What is the root cause of that problem?
The two surfaces render their lists through components that have no search capability, and neither applies the app-wide
CONST.STANDARD_LIST_ITEM_LIMIT(= 12) convention:The quick switcher (
AccountSwitcher) builds its rows inmenuItems()and hands the full unfiltered array to the legacyPopoverMenu:App/src/components/AccountSwitcher.tsx
Lines 299 to 320 in 13c2d5d
PopoverMenu's body renders only the header text, the optional sub-menu back row, and the menu rows — there is no text input anywhere in the component:App/src/components/PopoverMenu/index.tsx
Lines 719 to 727 in 13c2d5d
The Copilots page builds
delegatorMenuItems/delegateMenuItemsand renders both through plainMenuItemLists, with no size check or filter:App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 446 to 457 in 13c2d5d
The 12-item search convention lives in
SelectionListconsumers (e.g.CategoryPicker/index.tsxgatesshouldShowTextInputoncategoriesCount >= CONST.STANDARD_LIST_ITEM_LIMIT), and neither copilot surface is on that path:App/src/CONST/index.ts
Line 5199 in 13c2d5d
What changes do you think we should make in order to solve the problem?
Reuse the two search patterns that already ship in production, one per surface, with zero changes to the shared
PopoverMenu.Surface 1 — quick switcher: reuse the anchored-popover + SelectionList pattern that
CategoryPickerModalalready ships.The main objection raised against a
SelectionListhere is that "no compact anchored popover in the app hosts a SelectionList" — but one does, in production:CategoryPickerModalrenders the threshold-searchable category picker insidePopoverWithMeasuredContent:App/src/components/CategoryPicker/CategoryPickerModal.tsx
Lines 64 to 80 in 13c2d5d
App/src/components/CategoryPicker/index.tsx
Lines 89 to 93 in 13c2d5d
Apply the same pattern to the switcher: keep the existing trigger, anchor position, and
maxHeight: windowHeight / 2cap, and render the account list with aSelectionListinsidePopoverWithMeasuredContentinstead ofPopoverMenu:menuItems()builds today (pinned current-user radio row + alphabetized delegators with avatar,Full/Limitedrole badge, and connect-error red dot) onto the shared list-item model.shouldShowTextInput={delegators.length >= CONST.STANDARD_LIST_ITEM_LIMIT}, withtextInputOptionsusing the existingworkspace.people.findMember("Find member") string from the design, filtering by display name + login viatokenizedSearch, and the standardcommon.noResultsFoundheader message.onSelectedbehavior (connect/disconnect, offline modal, GPS-in-progress confirmation) intoonSelectRowunchanged. The acting-as-delegate branch (max 2 rows) never reaches the threshold and stays as-is. The query resets naturally because the popover content unmounts on close.This gets search, filtering, empty state, and keyboard navigation over the filtered list for free from
SelectionList, and leavesPopoverMenubyte-for-byte untouched for its many other consumers — no new props, no edits to its hand-maintainedReact.memocomparator (L735–L754), and no manual re-syncing of its index-based arrow-key focus while filtering.Surface 2 — Copilots page: one combined "Find member"
SearchBar.The page already builds
sortedDelegators(L270–274) andsortedDelegates(L204–208, which already excludes optimistic placeholders). Combine both into one tagged collection and pipe it through the existinguseSearchResultshook (debounce + auto-reset below the limit built in, L36–L41) withtokenizedSearchon display name + email:SearchBar(label:workspace.people.findMember, matching the design screenshots) whensortedDelegators.length + sortedDelegates.length >= CONST.STANDARD_LIST_ITEM_LIMIT— the "access to/from other accounts" combined threshold from the scope comment.Frontend-only; no Onyx shape, API, or navigation changes.
How this differs from the other proposals on this issue: it changes neither the legacy
PopoverMenu(no new search props, no memo-comparator edits, no focus-index re-syncing) nor migrates toPopoverMenuv2 — it reuses the already-shippingCategoryPickerModalanchored-SelectionListprecedent for the switcher, and covers the clarified second surface with the standardSearchBar+useSearchResultsidiom.Test branch
Link
Demo
Screen.Recording.2026-07-16.at.6.32.25.PM.mov
melvin-bot commentedon Jul 15, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)[-]Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]137 remaining items
expensify-chore-bot commentedon Nov 16, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)[-][Due for payment 2026-09-30] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]mallenexpensify commentedon Nov 16, 2026
Please comment and tag me if/when payment is due, thx
[-][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][Due for payment 2026-11-28] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]melvin-bot commentedon Nov 21, 2026
@eh2077
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.51-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-11-28. 🎊
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]
[-][Due for payment 2026-11-28] [$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/-][+][$250] Copilot quick switcher is missing search input when the list contains more than 12 copilots[/+]mallenexpensify commentedon Nov 21, 2026
Please comment and tag me if/when payment is due, thx