-
Notifications
You must be signed in to change notification settings - Fork 17.1k
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
39.2.7
What operating system(s) are you using?
macOS
Operating System Version
macOS Tahoe 26.1
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
37.7.0
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
- User begins swiping between virtual desktops (see fix: handle failing to enter fullscreen on macOS #43112 for some context).
- Electron window requests fullscreen (the attached example gist attempts to toggle fullscreen every few seconds).
- The window fails to enter fullscreen mode (due to being halfway between two virtual desktops), but remains usable.
Actual Behavior
Upon failing to enter fullscreen mode, the contents of the window freeze. In the attached example gist, this is visible in two distinct ways:
- The red border around the window disappears on the right and bottom sides, which I believe is due to the contents of the window being rendered as if it is fullscreened (i.e. trying to fill the entire screen, but being clipped).
- The animated spinning box freezes.
Testcase Gist URL
https://gist.github.com/cptpcrd/bf28bf81d7cd4c4f4197367b54c708ba
Additional Information
I have bisected this down to a regression that first appeared between v37.7.0 and v37.7.1, specifically in #47151 (and its backports).
As best as I can tell, following the failed fullscreen transition, the OS briefly reports the window as first occluded (which causes OnWindowHide to run), then visible (which previously caused OnWindowShow to run, but following #47151 now does nothing). It seems that the mismatched calls cause Chromium to think the page is hidden and thus does not need to be rendered.
This change fixes the issue for me locally (though it also means WebContents::WasShown runs twice back-to-back when Show is called, which I suspect is undesirable):
--- a/shell/browser/api/electron_api_browser_window.cc
+++ b/shell/browser/api/electron_api_browser_window.cc
@@ -280,6 +280,7 @@ v8::Local<v8::Value> BrowserWindow::GetWebContents(v8::Isolate* isolate) {
}
void BrowserWindow::OnWindowShow() {
+ web_contents()->WasShown();
BaseWindow::OnWindowShow();
}