Skip to content

Copilot menu is misaligned under Account switch and has excessive padding in the top group label #95756

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.32-2
Reproducible in staging?: Y
Reproducible in production?: N (New feature)
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: @shawnborton
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to Account.
  2. Click the Copilot switch/button to open the menu.
  3. Observe the menu position relative to the switch.
  4. Observe the spacing below the top group label.

Expected Result:

The Copilot menu should open directly below the switch button, aligned consistently with other menus.
The top group label should have appropriate bottom padding, consistent with the rest of the menu.

Actual Result:

The Copilot menu does not launch directly below the switch button.
The top group label has excessive bottom padding, creating unnecessary whitespace.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Image
Recording.3176.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 9, 2026
  2. melvin-bot commented on Jul 9, 2026

    @melvin-bot

    Triggered auto assignment to @Valforte (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on Jul 9, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Jul 9, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. MelvinBot commented on Jul 9, 2026

    @MelvinBot
    Contributor

    Proposal (🤖 preliminary — medium confidence)

    Please re-state the problem that we are trying to solve in this issue.

    The account/Copilot switcher menu on the Account (Settings) page (1) doesn't open directly below the switch button, and (2) has too much whitespace below the "Switch account" header label.

    What is the root cause of that problem?

    Both come from AccountSwitcher.tsx, which renders inside the Settings header (InitialSettingsPage.tsx:580, wrapped in styles.pv4 = 16px vertical padding).

    1. Misalignment: the popover is anchored to a hardcoded screen coordinate, not to the button. AccountSwitcher.tsx:305 passes anchorPosition={CONST.POPOVER_ACCOUNT_SWITCHER_POSITION}, which is a fixed {horizontal: 12 + navigationTabBarSize, vertical: 72} → {84, 72} (CONST/index.ts:265, navigationTabBarSize = 72). PopoverMenu forwards this fixed point to PopoverWithMeasuredContent, so the menu lands at {84, 72} regardless of where the switch actually sits. Because the switch is offset by the header's pv4/ph5 padding, vertical: 72 no longer lines up with the bottom of the button.

    2. Excessive header padding: PopoverMenu renders the header label with styles.pv3 (12px top and bottom) at PopoverMenu/index.tsx:541. AccountSwitcher overrides only the top via headerStyles={styles.pt0} (AccountSwitcher.tsx:313), leaving a full 12px below the "Switch account" label → the extra whitespace.

    What changes do you think we should make in order to solve the problem?

    • Padding: reduce the header's bottom padding, e.g. headerStyles={[styles.pt0, styles.pb2]} (8px) or styles.pb0, tuned to match the spacing of the menu rows below it.
    • Alignment: make the menu open directly under the switch instead of a fixed point — either tune POPOVER_ACCOUNT_SWITCHER_POSITION to account for the header's pv4/ph5 offset, or anchor to the measured buttonRef position so it stays correct regardless of surrounding padding. The exact offset values are a design decision — shawnborton should confirm the intended spacing.

    What alternative solutions did you explore?

    Adjusting the wrapping header container padding in InitialSettingsPage instead of headerStyles — rejected because the excess padding is inside the popover header, not the page header.

    Confidence & verification notes
    • Padding cause is high confidence — directly traceable in code (pv3 = 12px, pt0 removes only top).
    • Alignment cause is medium confidence — the hardcoded-anchor mechanism is clear, but I did not run the app to confirm the exact pixel offset. Worth a quick browser check after adjusting the constant.
    • Not a duplicate of Expensify/App#92253 (Copilot discoverability, unrelated).

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/95756) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  6. OSBotify commented on Jul 9, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #93393 - "Make Copilot switching discoverable with a dedicated Switch button on the Accounts page" by @wildan-m (High confidence)
    Related Issues: #95693, #95717 (also caused by the same PR, per the revert)

    Recommendation: REVERT

    The reported symptoms (Copilot "Switch" button, misaligned menu, and top-group-label padding) come entirely from PR #93393, which introduced the dedicated Switch button. A revert (#95748) has already been merged and cherry-picked to staging, so this blocker should resolve on the next staging build — please re-verify and check it off once the build lands.

    Assigned: @wildan-m (PR author), @eh2077 and @inimaga (approving reviewers) from the causing PR #93393
    Labels: No label changes. Kept DeployBlockerCash (this is a frontend/App bug blocking the App deploy). There was no DeployBlocker label to remove.

    📋 Detailed Analysis

    Evidence

    Verification

    • Affected files/areas: the "Copilot switch" and its menu live in src/components/AccountSwitcher.tsx; the menu positioning constant lives in src/CONST/index.ts (POPOVER_ACCOUNT_SWITCHER_POSITION); the surrounding Account page is src/pages/settings/InitialSettingsPage.tsx.
    • PR Make Copilot switching discoverable with a dedicated Switch button on the Accounts page #93393's changed files include exactly these: src/components/AccountSwitcher.tsx, src/CONST/index.ts, and src/pages/settings/InitialSettingsPage.tsx (plus language files and a new tests/ui/AccountSwitcherTest.tsx).
    • The diff replaces the old full-row PressableWithFeedback with a small Button (text={translate('delegate.switch')}, iconRight={CaretUpDown}) and keeps the PopoverMenu anchored to that button via buttonRef using the fixed anchorPosition={CONST.POPOVER_ACCOUNT_SWITCHER_POSITION}.

    Root Cause

    1. Misaligned menu: The PopoverMenu still uses the fixed offset POPOVER_ACCOUNT_SWITCHER_POSITION ({ horizontal: 12 + navigationTabBarSize, vertical: 72 }), which was tuned for the previous full-width pressable row. With the new, small right-aligned "Switch" button as the anchor, this fixed offset no longer lands the menu directly beneath the button.
    2. Excessive bottom padding on the top group label: The popover header text is rendered with styles.pv3 (vertical padding, top and bottom) in src/components/PopoverMenu/index.tsx renderHeaderText(). AccountSwitcher passes headerStyles={styles.pt0}, which zeroes only the top padding and leaves the pv3 bottom padding, producing the excess whitespace under the top group label.

    Both are pure client-side (App repo) layout issues introduced by #93393, so this is a frontend bug and reverting #93393 is the correct fix.

  7. inimaga commented on Jul 9, 2026

    @inimaga
    Contributor

    Should be fixed once this revert makes it to staging: #95748

  8. Valforte commented on Jul 9, 2026

    @Valforte
    Contributor

    Thanks @inimaga

  9. inimaga commented on Jul 10, 2026

    @inimaga
    Contributor

    Retest requested here.

  10. IuliiaHerets commented on Jul 10, 2026

    @IuliiaHerets

    Issue is still reproducible when login with Copilot's accounts (not only Agent), Windows 11 / Chrome in v9.4.32-3

    • The Copilot menu does not launch directly below the switch button. (Still reproducible)
    • The top group label has excessive bottom padding, creating unnecessary whitespace. (Not reproducible)
    bandicam.2026-07-10.14-20-52-967.mp4
  11. IuliiaHerets commented on Jul 10, 2026

    @IuliiaHerets

    Not reproducible after clearing cookies

    bandicam.2026-07-10.15-03-31-256.mp4
  12. inimaga commented on Jul 10, 2026

    @inimaga
    Contributor

    Thanks for confirming!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions