Skip to content

Windows shrink the first time they lose focus on Wayland #48588

Closed

Description

@mitchchn

Preflight Checklist

Electron Version

38.3.0

What operating system(s) are you using?

Ubuntu

Operating System Version

Ubuntu 24.04

What arch are you using?

x64

Last Known Working Electron version

No response

Does the issue also appear in Chromium / Google Chrome?

No

Expected Behavior

An 800x600 window should be able to keep consistent dimensions after creation, including when it loses focus.

Actual Behavior

An 800x600 window goes on a journey after you create it, first starting at 800x600 absolute bounds (which is incorrect: see #48589), then growing to its proper size after creation and then shrinking to about 785x580 if you click out of it to lose focus.

Logs from the Fiddle:

Main window bounds at creation: { x: 645, y: 172, width: 800, height: 600 }
Main window bounds after 1s: { x: 0, y: 0, width: 844, height: 644 }
Main window bounds after blur (assuming you manually de-focused it): { x: 0, y: 0, width: 822, height: 625 }

Testcase Gist URL

https://gist.github.com/mitchchn/7487efc43b208a3624ba464cb156860d

Additional Information

Some context to help diagnose the root cause: on Wayland (and in GNOME specifically), Electron draws all window decorations using CSD, including titlebars, borderes, and shadows.

This means that an 800x600 BrowserWindow actually sits inside a larger 844x644 transparent frame into which the active shadows are drawn. When the window goes inactive, the shadows are drawn thinner, so the transparent frame shrinks. This incorrectly causes the client area of the window to shrink as well. (But for some reason everything works fine after the first time the window loses focus on subsequent focus cycles.)

Activity

  1. added theissue type on Oct 19, 2025
  2. added
    has-repro-gist
    on Oct 19, 2025
  3. moved this to 👀 Unsorted Items in 38-x-yon Oct 19, 2025
  4. mitchchn commented on Oct 19, 2025

    @mitchchn
    MemberAuthor

    In a different VM with 38.3.0 I get a window which never manages to grow to its full dimensions at all, so it loads at "800x600" but was visually much smaller:

    Main window bounds at creation: { x: 1328, y: 784, width: 800, height: 600 }
    Main window bounds after 1s: { x: 0, y: 0, width: 800, height: 600 }
    Main window bounds after blur (assuming you manually de-focused it): { x: 0, y: 0, width: 800, height: 600 }
    

    And on bare metal with 38.2.2, I actually had a window GROW after being de-focused the first time from the shrunken state to its proper bounds:

    Main window bounds at creation: { x: 1320, y: 420, width: 800, height: 600 }
    Main window bounds after 1s: { x: 0, y: 0, width: 844, height: 644 }
    Main window bounds after blur (assuming you manually de-focused it): { x: 0, y: 0, width: 844, height: 644 }
    

    I think there are weird timing issues at window creation that can depend on compositor/GPU/Chromium which we need to simply guard against.

  5. nikwen commented on Oct 22, 2025

    @nikwen
    Member
  6. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 38-x-yon Oct 22, 2025
  7. electron-issue-triage commented on Jan 21, 2026

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    38-x-ybug 🪲component/BaseWindowhas-repro-gistplatform/linuxstalewayland

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions