Skip to content

Conversation

@notnotjake
Copy link
Contributor

Context menus close when the window becomes inactive (e.g., clicking to another window or app). Previously, menus would remain visible until the window regained focus.

This aligns Zed's context menu behavior with native macOS apps, where NSMenu automatically dismisses when the window loses focus. Users expect menus to close when switching windows or apps.

Uses observe_window_activation to detect when the window becomes inactive and calls cancel to dismiss the menu.

Release Notes:

  • Fixed context menus dismiss/cancel when the window loses focus
Context menus now close when the window becomes inactive (e.g., clicking
to another window or app). Previously, menus would remain visible until
the window regained focus.

Uses `observe_window_activation` to detect when the window becomes
inactive and calls `cancel` to dismiss the menu.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 15, 2026
@maxdeviant maxdeviant changed the title ui: dismiss context menus when window loses focus Jan 15, 2026
Copy link
Member

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

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

Thanks!

@danilo-leal danilo-leal enabled auto-merge (squash) January 15, 2026 13:48
@danilo-leal danilo-leal merged commit d139c5e into zed-industries:main Jan 15, 2026
23 checks passed
@notnotjake notnotjake deleted the proposed/context-menu-dismiss-on-blur branch January 16, 2026 07:16
ConradIrwin added a commit that referenced this pull request Jan 28, 2026
@ConradIrwin ConradIrwin mentioned this pull request Jan 28, 2026
@ConradIrwin
Copy link
Member

I'm not sure why yet, but this seems to have caused two problems: the terminal lost focus when window switching, and the macOS emoji picker stopped working. I'm reverting in #47835

ConradIrwin added a commit that referenced this pull request Jan 28, 2026
- **Revert "ui: Dismiss context menus when window loses focus
(#46866)"**
- **Revert "Preserve and restore focus across window activation cycles
(#47044)"**

Closes #ISSUE

Release Notes:

- (preview only) Fixed typing emoji using the macOS system palette
(cmd-ctrl-space)
github-actions bot pushed a commit that referenced this pull request Jan 28, 2026
- **Revert "ui: Dismiss context menus when window loses focus
(#46866)"**
- **Revert "Preserve and restore focus across window activation cycles
(#47044)"**

Closes #ISSUE

Release Notes:

- (preview only) Fixed typing emoji using the macOS system palette
(cmd-ctrl-space)
zed-zippy bot added a commit that referenced this pull request Jan 28, 2026
Cherry-pick of #47835 to preview

----
- **Revert "ui: Dismiss context menus when window loses focus
(#46866)"**
- **Revert "Preserve and restore focus across window activation cycles
(#47044)"**

Closes #ISSUE

Release Notes:

- (preview only) Fixed typing emoji using the macOS system palette
(cmd-ctrl-space)

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

3 participants