Skip to content

fix(macos): raise inactive windows on synthetic content clicks - #476

Open
mouzhi wants to merge 1 commit into
feschber:mainfrom
mouzhi:fix/macos-raise-inactive-window-on-click
Open

fix(macos): raise inactive windows on synthetic content clicks#476
mouzhi wants to merge 1 commit into
feschber:mainfrom
mouzhi:fix/macos-raise-inactive-window-on-click

Conversation

@mouzhi

@mouzhi mouzhi commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • macOS 27 no longer focuses/raises inactive windows when a synthetic click lands on the window body
  • title-bar clicks still work, but content-area clicks can interact without activating the target window
  • keyboard input then stays on the previous frontmost app

Fix

Before posting LeftMouseDown, look up the Accessibility element under the pointer and:

  • AXRaise the owning window
  • set AXMain / AXFocused on the window when available
  • set AXFrontmost on the owning application

This is a compatibility workaround for the macOS 27 synthetic-event regression.

Test plan

  • Build lan-mouse on macOS aarch64
  • Control a macOS 27 machine from Windows via lan-mouse
  • Click an inactive/background window title bar → still focuses/raises
  • Click an inactive/background window content area → now focuses/raises and accepts keyboard input
  • Verify Accessibility + Input Monitoring remain granted after installing the patched binary

Fixes #464

macOS 27 no longer focuses/raises inactive windows when a synthetic
mouse click lands on the window body. Title-bar clicks still work, but
content-area clicks can interact without activating the window, so
keyboard input stays on the previous frontmost app.

Before posting LeftMouseDown, look up the AX element under the pointer
and raise/focus the owning window and application via Accessibility.

Fixes feschber#464
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.

macOS 27: Clicking inactive window content does not focus/raise window

1 participant