Clicking panel windows activates the app on macOS 27
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
44.0.0
What operating system(s) are you using?
macOS
Operating System Version
macOS 27.0 (26A5416b)
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
N/A
Does the issue also appear in Chromium / Google Chrome?
I don't know how to test
Expected Behavior
A type: 'panel' window should accept clicks without activating the app. After switching to another app, clicking a button in the panel should run the button's handler and leave the other app active.
Actual Behavior
Clicking the button makes Electron the active app instead. Electron emits did-become-active.
Testcase Gist URL
https://gist.github.com/danteissaias/5334864f77f77f3b099f408c66d3346b
Repro steps:
- Run the Fiddle on macOS 27 with Electron 44.0.0.
- Switch to another app (e.g. Finder). The green panel stays visible because it uses
alwaysOnTop: true. - Click the panel's “Click me” button.
- Notice that the button text changes, but Electron also becomes active. The console logs
did-become-active.
Additional Information
I found a workaround, but it requires a rather horrible private AppKit API. A small native addon calls this method on the panel before it is shown:
[window _setPreventsActivation:YES];With this call, the button still works and the previous app stays active. Clicking the panel no longer emits did-become-active.
Source: electron/electron