fix(macos-helper): skip the window-sharing indicator when choosing the front window

JA
2d ago
+71-3

Summary

With AGENT_DEVICE_MACOS_APP_BACKEND=native, scroll refused with no scroll area with a settable scroll bar under the window center for an app whose window was being shared, and screenshot returned a 132x40 image.

While a ScreenCaptureKit stream captures an app window, macOS 27 adds a 66x20 layer-0 window in front of it. That window's only child is a button titled WindowSharingSessionButton. frontWindow picked this indicator, so scroll hit-tested its center and screenshot captured it. Now, when the app has more than one eligible window, frontWindow skips a front candidate whose accessibility window is that indicator. The probe is bounded: 0.1 s per element, 0.5 s in total. A lone window never triggers an accessibility read.

Not the #3888 shape: unshared ScrollView, Form, and NavigationSplitView pages scroll on base.

4 files. Related: #3213.

Validation

Head 497da48a2, base 45125d717.

  • pnpm check:affected --run --head 497da48a2 passed (exactCommit: true). macos-helper is GitHub-authoritative.
  • swift test in apple/macos-helper: 22 passed.

Live runs on macOS 27.0, with the indicator window present:

TargetHelperscrollscreenshot
Hosted Stim Desktop on a second Mac (its streamed window)baseno-scroll-bar132x40
head 497da48a2scrolled, referenceHeight: 7721800x1544
Local SwiftUI fixture, shared via SCStreambaseno-scroll-bar132x40
335b2f104scrolled3840x1936

The fixture run predates the probe-bounding commits; the hosted run covers the head.