From a6c40301b80a8679b59693efc140c42140778a24 Mon Sep 17 00:00:00 2001 From: Livio Gamassia Date: Tue, 20 Oct 2026 23:35:58 +0200 Subject: [PATCH] Stop the kiosk window from stealing key focus from the primary display The Edge dashboard window could become key, so every tap moved the keyboard focus off the app being typed into on the main display, and a shortcut such as Cmd-V landed in the dashboard. FirstMouseWebView already delivers the first click through acceptsFirstMouse, so the window needs no key status. It is now a non-activating NSPanel that refuses key and main. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 4 ++++ .../Sources/FremkitHelper/KioskWindow.swift | 23 +++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ec051c..774c120f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ tagged `vX.Y.Z`. ### Fixed +- **Tapping the Edge dashboard no longer steals the keyboard.** The dashboard window took the + key focus on every tap, so the app you were typing into on the main display lost it and a + shortcut such as ⌘V landed in the dashboard. The window is now a non-activating panel that + never becomes key; touches still reach the page. - **The clipboard widget masks one-time codes.** A six-digit code copied from a text message or an authenticator (`482913`, `482 913`, `4829-1375`) showed in full on the Edge and on a paired iPad; any run of four to eight digits copied on its own is now shown as a secret, and still diff --git a/native/Sources/FremkitHelper/KioskWindow.swift b/native/Sources/FremkitHelper/KioskWindow.swift index af06c98c..0cfb27e7 100644 --- a/native/Sources/FremkitHelper/KioskWindow.swift +++ b/native/Sources/FremkitHelper/KioskWindow.swift @@ -31,13 +31,14 @@ extension NSRect { } } -/// Borderless window that can still take the keyboard focus. +/// Borderless non-activating panel that never takes the keyboard focus. /// -/// `NSWindow` refuses to become key or main when it is borderless, which in an accessory -/// (`LSUIElement`) app leaves the dashboard unable to receive clicks and key events at all. -private final class KioskNSWindow: NSWindow { - override var canBecomeKey: Bool { true } - override var canBecomeMain: Bool { true } +/// Touches reach the page through `acceptsFirstMouse` on the web view below, so the window has +/// no need to become key. Refusing it keeps the app the user is typing into frontmost on the +/// primary display when a tap lands on the Edge dashboard. +private final class KioskNSWindow: NSPanel { + override var canBecomeKey: Bool { false } + override var canBecomeMain: Bool { false } } /// Web view that lets the very first click reach the page. @@ -85,10 +86,12 @@ final class KioskWindow: NSObject, WKNavigationDelegate { self.url = url self.access = access - window = KioskNSWindow(contentRect: frame, - styleMask: .borderless, - backing: .buffered, - defer: false) + let panel = KioskNSWindow(contentRect: frame, + styleMask: [.borderless, .nonactivatingPanel], + backing: .buffered, + defer: false) + panel.hidesOnDeactivate = false + window = panel // Above the menu bar and status items: with "Displays have separate Spaces" macOS draws // a menu bar on every display, and a floating window would leave it visible on the Edge. window.level = Self.kioskLevel