You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Window size changes when being moved if resizable is false #13043
Operating System (Platform and Version): Windows 10
Last known working Electron version: before commit bb5eecc
Expected Behavior
Width and height of a window should not change while being dragged
Actual behavior
Width and height become smaller.
To Reproduce
Create a window with:
var mainWindow = new BrowserWindow({width: 1024, height: 880, x: 30, y: 30,
resizable: false })
Then drag the window. Width and height become smaller than specified (1024, 880)
Additional Information
NativeWindowViews::SetBounds calls SetMin/MaxSize(bounds) when resizable_ is false. bounds get adjusted to smaller numbers by WindowBoundsToContentBounds.
Reacted by Sam Vloeberghs, Leo sun, liang feng, Dawn T, Tedis Agolli, deiv23, Sheralijon and Frombit
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
So, just to confirm that we see the same thing - the windows stays visibly the same size, but a bunch of resize events get emitted with sizes that fluctuate between the size that was set and one that's one pixel off (and only when scaling is not 100%)?
Can you make me a repo to reproduce this? I've found something that I thought was what you were talking about, but now I'm not sure I know what's going on.
I tested this with 2.0.2, do you see this with that version?
I would like to add that I am seeing the same issue. We use not attached dev tools as well, however this is also reproducible on an electron-forge binary build of our app as well (which obviously does not open the dev tools), so I do not know if that is a cause.
My app starts at a size of 846x478 and upon dragging only the first time after the app has opened it becomes 840x449. Which happens to be the exact loss of 6x29 as seen above. Our repo is unfortunately private, so I cannot share the link. Please let me know what information you may need from me.
We are using electron version 2.0.2 and I am on Windows 10 version 1709 (OS Build 16299.371)
I'm facing the same issue but I noticed that it happens only when the menu is present. When I disable the menu with window.setMenu(null); the window moves fine.
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!
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
I found a solution for this issue by setting win.setPosition( x, y ). I set my coordinates to where I wanted the window to load and found that there is no longer any unwanted resizing.
I am unsure if this is a blanket solution, but it did fix this re-sizing issue while setResizeable is set to false.
I found a solution for this issue by setting win.setPosition( x, y ). I set my coordinates to where I wanted the window to load and found that there is no longer any unwanted resizing.
I am unsure if this is a blanket solution, but it did fix this re-sizing issue while setResizeable is set to false.
Currently using release 25.5.0
Good luck!
This seems to work when device pixel ratio is 1. However, the problem is back if it isn't 1 (when you set "Make everything bigger" to anything above 100% under Windows).
I found a solution for this issue by setting win.setPosition( x, y ). I set my coordinates to where I wanted the window to load and found that there is no longer any unwanted resizing.
I am unsure if this is a blanket solution, but it did fix this re-sizing issue while setResizeable is set to false.
Currently using release 25.5.0
Good luck!
This seems to work when device pixel ratio is 1. However, the problem is back if it isn't 1 (when you set "Make everything bigger" to anything above 100% under Windows).
Good to know this tidbit now. Thanks for the feedback!
I found a solution for this issue by setting win.setPosition( x, y ). I set my coordinates to where I wanted the window to load and found that there is no longer any unwanted resizing.
I am unsure if this is a blanket solution, but it did fix this re-sizing issue while setResizeable is set to false.
Activity
welcome commentedon May 22, 2018
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
brenca commentedon May 22, 2018
So, just to confirm that we see the same thing - the windows stays visibly the same size, but a bunch of resize events get emitted with sizes that fluctuate between the size that was set and one that's one pixel off (and only when scaling is not 100%)?
wenjunche commentedon May 22, 2018
scaling is at 100%. The window changes size as soon as I drag it.
When I run the example I listed earlier, the followings are what I see in devtools->console
Before I move the window:
window.outerHeight
880
window.outerWidth
1024
After I move the window
window.outerHeight
851
window.outerWidth
1018
brenca commentedon May 22, 2018
Can you make me a repo to reproduce this? I've found something that I thought was what you were talking about, but now I'm not sure I know what's going on.
I tested this with 2.0.2, do you see this with that version?
Repo for electron/electron#13043
wenjunche commentedon May 22, 2018
same issue with 2.0.2
Here my repo: https://github.com/wenjunche/electron-13043
brenca commentedon May 24, 2018
Are you using the non-detached devtools? If so, I think I know what you mean.
incomingstick commentedon Jun 20, 2018
I would like to add that I am seeing the same issue. We use not attached dev tools as well, however this is also reproducible on an electron-forge binary build of our app as well (which obviously does not open the dev tools), so I do not know if that is a cause.
My app starts at a size of 846x478 and upon dragging only the first time after the app has opened it becomes 840x449. Which happens to be the exact loss of 6x29 as seen above. Our repo is unfortunately private, so I cannot share the link. Please let me know what information you may need from me.
We are using electron version 2.0.2 and I am on Windows 10 version 1709 (OS Build 16299.371)
jahraphael commentedon Jun 20, 2018
I wanted to follow up to what @incomingstick with a couple more things:
Downgrade electron for windows to 1.8.7
ianshade commentedon Jul 25, 2018
I'm facing the same issue but I noticed that it happens only when the menu is present. When I disable the menu with
window.setMenu(null);the window moves fine.24 remaining items
th3jesta commentedon Jul 7, 2021
Experiencing in 13.1.4. Very irritating.
hgalocy commentedon Jul 30, 2021
This line fixes the bug:
win.on('will-move', (e) => { win.setSize(yourWidth, yourHeight) });Adjust your width and height accordingly.
github-actions commentedon Oct 8, 2022
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!
github-actions commentedon Nov 8, 2022
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
edosssa commentedon Jan 6, 2023
Still happening :(
parkdongcheol commentedon Aug 29, 2023
I found a solution for this issue by setting win.setPosition( x, y ). I set my coordinates to where I wanted the window to load and found that there is no longer any unwanted resizing.
I am unsure if this is a blanket solution, but it did fix this re-sizing issue while setResizeable is set to false.
Currently using release 25.5.0
Good luck!
fzf404 commentedon Sep 18, 2023
It's still happening in Electron 26.2.1.
ButzYung commentedon Sep 23, 2023
This seems to work when device pixel ratio is 1. However, the problem is back if it isn't 1 (when you set "Make everything bigger" to anything above 100% under Windows).
parkdongcheol commentedon Sep 27, 2023
Good to know this tidbit now. Thanks for the feedback!
LucileGrnd commentedon Mar 13, 2024
Hi, any news about this?
MSJavaScript commentedon Apr 9, 2024
However, if I move the setMenu line below, the problem is solved
DenisFV commentedon May 31, 2024
Calling setSize() twice fixes this
farid-azihub commentedon Jan 13, 2025
This fixed the issue for me, thanks!
@parkdongcheol