Skip to content

[Bug]: Maximize window visual glitch on Windows #35246

Description

@Adam777Z

Preflight Checklist

Electron Version

20.0.1

What operating system are you using?

Windows

Operating System Version

Windows 11

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

No visual glitch, the whole window showing the background color (default or set using backgroundColor) until the content is loaded.

Actual Behavior

On Windows using the maximize method of BrowserWindow after opening the app's window causes a visual glitch until it loads the content.
This results in a bad user experience.
Tested on Windows 10 & 11 64-bit.
Also tested on Ubuntu 22.04 64-bit, it's good, no visual glitch.
Tried with default window width and height.

Method:
https://www.electronjs.org/docs/latest/api/browser-window#winmaximize

Code:

const win = new BrowserWindow();
win.maximize();

Workaround:
Don't show the window, maximize it, then show it:

const win = new BrowserWindow({show: false});
win.maximize();
win.show();

Or hide the window, then maximize it, then show it:

const win = new BrowserWindow();
win.hide();
win.maximize();
win.show();

Test:
https://github.com/Adam777Z/electron-windows-visual-glitch-test

Testcase Gist URL

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions