From bf754a3cae84fba9896011320c09c0fe554886b2 Mon Sep 17 00:00:00 2001 From: James Yuzawa Date: Wed, 17 Apr 2024 12:42:34 -0400 Subject: [PATCH] fix: make window.flashFrame(bool) flash continuously on macOS (#41391) fix: window.flashFrame to flash continuously on mac This brings the behavior to parity with Windows and Linux. Prior behavior: The first `flashFrame(true)` bounces the dock icon only once (using the [NSInformationalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nsinformationalrequest) level) and `flashFrame(false)` does nothing. New behavior: Flash continuously until `flashFrame(false)` is called. This uses the [NSCriticalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nscriticalrequest) level instead. To explicitly use `NSInformationalRequest` to cause a single dock icon bounce, it is still possible to use [`dock.bounce('informational')`](https://www.electronjs.org/docs/latest/api/dock#dockbouncetype-macos). --- docs/breaking-changes.md | 4 ++++ shell/browser/native_window_mac.mm | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 6f8e3b19b6f8d..dfc1798178f1b 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -21,6 +21,10 @@ encoded data returned from this function now matches it. See [crbug.com/332584706](https://issues.chromium.org/issues/332584706) for more information. +### Behavior Changed: `window.flashFrame(bool)` will flash dock icon continuously on macOS + +This brings the behavior to parity with Windows and Linux. Prior behavior: The first `flashFrame(true)` bounces the dock icon only once (using the [NSInformationalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nsinformationalrequest) level) and `flashFrame(false)` does nothing. New behavior: Flash continuously until `flashFrame(false)` is called. This uses the [NSCriticalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nscriticalrequest) level instead. To explicitly use `NSInformationalRequest` to cause a single dock icon bounce, it is still possible to use [`dock.bounce('informational')`](https://www.electronjs.org/docs/latest/api/dock#dockbouncetype-macos). + ## Planned Breaking API Changes (30.0) ### Behavior Changed: cross-origin iframes now use Permission Policy to access features diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 7fab6b14bdc0c..e9909c0a53dd5 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1004,7 +1004,7 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) { void NativeWindowMac::FlashFrame(bool flash) { if (flash) { - attention_request_id_ = [NSApp requestUserAttention:NSInformationalRequest]; + attention_request_id_ = [NSApp requestUserAttention:NSCriticalRequest]; } else { [NSApp cancelUserAttentionRequest:attention_request_id_]; attention_request_id_ = 0;