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