mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* fix: show macOS context menus reliably after a previous one is cancelled -[ElectronMenuController cancel] dismissed the menu with -cancelTracking, which plays a fade-out animation. While that animation runs, a following -popUpMenuPositioningItem:atLocation:inView: returns without showing the menu or calling -menuWillOpen:, so a Menu.popup() made right after Menu.closePopup() (or after a cancelled popup on another window) showed nothing, and neither 'menu-will-show', 'menu-will-close' nor the popup callback ever fired. Use -cancelTrackingWithoutAnimation instead, and clear isMenuOpen_ before calling it so that a -menuDidClose: delivered during the cancel is ignored and 'menu-will-close' and the close callback are still reported exactly once, from -cancel. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS * test: cover reopening a macOS popup menu from a closed popup's callback Pops a menu up, closes it with closePopup() once it shows, and pops it up again from the first popup's callback. Both popups must emit exactly one menu-will-show, one menu-will-close and one callback, in order. With the animated -cancelTracking the second popup showed nothing, so the test timed out. It runs with retry: 0 because every attempt repeats the same sequence, so a retry could only hide a regression. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LPMvJBQiyP6b7QjatACmnS --------- Co-authored-by: Claude <noreply@anthropic.com>