Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Electron setContentBounds / setContentSize doesn't work #42178

Closed
3 tasks done
brondibur opened this issue May 14, 2024 · 3 comments
Closed
3 tasks done

[Bug]: Electron setContentBounds / setContentSize doesn't work #42178

brondibur opened this issue May 14, 2024 · 3 comments
Labels
30-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/

Comments

@brondibur
Copy link

Preflight Checklist

Electron Version

30.0.4

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

setContentBounds / setContentSize resize the contents relative to the window.

Actual Behavior

setContentBounds / setContentSize actually behave like setBounds and set the bounds of the entire window instead of the contents within it.

Testcase Gist URL

https://gist.github.com/brondibur/f063baec603e95a206a3e69afafd32a1

Additional Information

In the Fiddle Gist, setContentBounds({ x: 10, y: 10, width: 400, height: 300 }) should set the contents as 400x300 originating from (10, 10) within the 800x600 window, whereas it converts the BrowserWindow to 400x300 that originates from (10, 10) of the screen.
Same goes for setContentSize

@electron-issue-triage electron-issue-triage bot added 30-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels May 14, 2024
@brondibur
Copy link
Author

Hi @codebytere

Bug reports for this issue have been incorrectly closed multiple times (#41665, #33969, #23758).

Can you please take a look?

@codebytere
Copy link
Member

This unfortunately has never worked as you expect - we should probably reclassify this as a feature request or otherwise decide what to do with those functions.

@codebytere
Copy link
Member

@brondibur following up on this - it was never intended to work that way. It resizes the window bounds according to then content area, but it never resized content without affecting window bounds at all. You can use webContentsView to do what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

2 participants