Skip to content

fix: prevent panel activation on macOS 27 - #54807

Open
Orpheuscn wants to merge 1 commit into
electron:mainfrom
Orpheuscn:codex/fix-macos27-panel-activation
Open

Orpheuscn wants to merge 1 commit into
electron:mainfrom
Orpheuscn:codex/fix-macos27-panel-activation

Conversation

@Orpheuscn

Copy link
Copy Markdown

Description of Change

Fixes #53889.

On macOS 27, clicking a non-focusable BrowserWindow created with type: 'panel' can activate the Electron app. This applies the AppKit panel activation-prevention hook when Electron creates the native panel, and adds a regression spec that uses real OS mouse input to verify the panel receives a click while Electron remains inactive.

Checklist

  • I have built and tested this change
  • I have filled out the PR description
  • I have reviewed and verified the changes
  • npm test passes
  • tests are changed or added
  • relevant API documentation, tutorials, and examples are updated
  • PR release notes describe the change in a way relevant to app developers

Release Notes

Notes: Fixed panel windows activating their app on macOS 27.

Testing

  • git show --check HEAD
  • Not run: Electron build and test dependencies are not bootstrapped in this checkout.

@welcome

welcome Bot commented Oct 9, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

zoolsher added a commit to rome-os/rome that referenced this pull request Oct 23, 2026
…1281)

## What this PR does

On macOS 26.6, every press on the floating icon activates Rome. Becoming
active hides the icon, so a trackpad drag (three-finger or
press-and-drag) never starts. Rome comes to the front instead. A click
looked fine only because activation raises Rome anyway. The icon's page
never received the press.

The cause is
[electron/electron#53889](electron/electron#53889).
Electron's `type: "panel"` window reports the non-activating style from
its `styleMask` getter but never sets it, so the window server activates
the app on the press. The issue reports this on macOS 27, which is why
#462 keeps the icon off there. A trace on macOS 26.6.2 shows the same
thing for trackpad presses. The upstream fix
([electron/electron#54807](electron/electron#54807),
open) applies only to macOS 27.

This sets AppKit's `_setPreventsActivation:` on the icon's window once,
through koffi, before the window is shown.

## Design & Invariants

- Pressing, clicking or dragging the icon leaves the frontmost app
frontmost. Only a click raises Rome, through the icon's own click
handling.
- The private method is called only after `respondsToSelector:` confirms
it exists. If a macOS release drops it, the icon goes back to activating
Rome, Rome logs a warning, and nothing crashes.
- The native FFI module loads only when the icon window is created,
which happens only on macOS. Other platforms never open it.
- The packaged app carries koffi's loader and its two macOS binaries
(2.8 MB), not its sources or the other platforms' binaries (29 MB).

Considered and rejected: a small native addon in the repo, which adds a
native build step for one message send; and turning the icon off on
macOS 26.6 and later until upstream ships a fix, which removes the
feature.

## Test plan

- [x] macOS 26.6.2, real trackpad, debug build with event logging:
before the change, a click, a three-finger drag and a press-and-drag
each logged an app activation and no `pointerdown`. After it, 11 of 11
drags were recognized as drags with no activation, and a click opened
Rome through the icon's click handler.
- [x] Unpacked dev build, synthetic mouse drags with Finder frontmost:
the icon follows the cursor exactly and Finder stays frontmost.
- [x] Packaged unsigned `.app` (`electron-builder --dir`): koffi loads
from `app.asar.unpacked`, 3 of 3 drags move the icon with Finder
frontmost, and a click brings Rome to the front.
- [x] Unit tests: the flag is set, and nothing is sent when the method
is missing or the view has no window.
- [ ] Signed and notarized build. The existing entitlements already
allow unsigned executable memory and disable library validation.

Exercised on a MacBook (macOS 26.6.2, Electron 44.9.3) with a separate
profile. Synthetic drags were posted as CGEvents.

## Not in this PR

- macOS 27 stays off in `supportsFloatingPill`. This fix may cover it
too, but it has not been run there.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

This branch has not been deployed

No deployments
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.

Clicking panel windows activates the app on macOS 27

1 participant