Skip to content

getBounds() and setBounds() are inaccurate on scale factors above 100% #51730

Closed as duplicate

Description

@nikwen

Preflight Checklist

Electron Version

42.2.0

What operating system(s) are you using?

Windows

Operating System Version

Windows 11 Pro 25H2

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

I haven't tested whether it worked in the past

Does the issue also appear in Chromium / Google Chrome?

I don't know how to test

Expected Behavior

At a 200% scale factor, if I run window.setBounds({ x: 200, y: 200, width: 400, height: 400 }), the window should take up the rectangle with the top left corner (400, 400) and the bottom right corner (1200, 1200).

Actual Behavior

The window takes up the rectangle with the top left corner (395, 400) and the bottom right corner (1205, 1205).

Image

window.getBounds() reports { x: 200, y: 200, width: 400, height: 400 }, which matches the window.setBounds() call but not the actual size of the window.

Testcase Gist URL

https://gist.github.com/nikwen/1926b6534e90feb4a0cfd947c5da3a9b

Additional Information

@mitchchn reported here that he only sees the issue at scale factors above 100%. At 100%, everything seems to work fine. (I currently have no way to test at 100%.) This indicates the issue might come from rounding errors.

(This is not an issue I care deeply about. Just an issue I extracted from #51679.)

Activity

  1. added theissue type on May 21, 2026
  2. added
    has-repro-gist
    on May 21, 2026
  3. moved this to 👀 Unsorted Items in 42-x-yon May 21, 2026
  4. added
    status/confirmed
    on May 21, 2026
  5. mitchchn commented on May 21, 2026

    @mitchchn
    Member

    @nikwen I also filed this one previously #51572.

  6. nikwen commented on May 22, 2026

    @nikwen
    MemberAuthor

    Marking as duplicate upon @mitchchn's request.

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

    42-x-ybug 🪲component/BrowserWindowhas-repro-gistplatform/windowsstatus/confirmed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions