Skip to content

fix: accept first click in Codex account switcher#1079

Merged
steipete merged 2 commits into
steipete:mainfrom
ptstory:fix/switcher-first-click
May 21, 2026
Merged

fix: accept first click in Codex account switcher#1079
steipete merged 2 commits into
steipete:mainfrom
ptstory:fix/switcher-first-click

Conversation

@ptstory
Copy link
Copy Markdown
Contributor

@ptstory ptstory commented May 21, 2026

Summary

Fix first-click acceptance in the Codex account switcher for menu bar
popovers that aren't key windows.

Split from #1073 per review feedback.

Not included

Problem

The plain NSButton inside CodexAccountSwitcherView dropped the first
click because the menu popover wasn't key.

Root cause of test failure: the runtime-click tests synthesized hit
points before NSStackView laid out the switcher rows, so every button
still sat at {0,0} and the simulated click always resolved to the
first account.

Changes

  • Override acceptsFirstMouse(for:)true
  • Swallow child button hit testing so the parent switcher view handles mouse events
  • Handle first-click selection through parent mouseDown/mouseUp with correct coordinate space conversion for multi-row layouts
  • Fix DEBUG runtime-click helpers to force layout before synthesizing click events

Testing

  • swift test --filter StatusMenuCodexSwitcherTests ✅ — all tests pass, including multi-row click targeting

ptstory and others added 2 commits May 21, 2026 18:47
Override acceptsFirstMouse, swallow child hit testing, and implement mouseDown/mouseUp with correct coordinate space conversion for multi-row account layouts.

Root cause: the runtime-click tests synthesized hit points before NSStackView laid out the switcher rows, so every button still sat at {0,0} and the simulated click always resolved to the first account.

Split from steipete#1073.
@steipete steipete force-pushed the fix/switcher-first-click branch from 5318b2c to 49a1edb Compare May 21, 2026 17:51
@steipete steipete merged commit 5586914 into steipete:main May 21, 2026
4 checks passed
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.

2 participants