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 height shrinking after being restored #16900
Electron Version (output of node_modules/.bin/electron --version):
4.0.4 (multiple versions have been tested, going back to 3.0.0)
Operating System (Platform and Version):
Windows 10
Last known working Electron version (if applicable):
n/a
Expected Behavior
If a window is minimised then restored, it retains its original size.
Actual behavior
The BrowserWindow is set to a precise width and height, if it is minimised using the button in the top right then restored, it will resize its height. This new height will be the original height - 20 (approximately the height of the menu bar). If the height is set again using window.setSize, then it will again be 20 off, as if the window height now takes into account the menu when it didn't before.
This can occur multiple times. Repeatedly minimising and restoring the window will reduce the window by the menu height each time.
This resize triggers the "resize" event, but not "will-resize", so it can't be blocked with e.preventDefault.
No other code interacts with the window height.
I've "fixed" this issue with the following hack: mainWindow.on('restore', function () { if (process.platform === 'win32') { mainWindow.setSize(windowWidth, windowHeight + 20); } });
To Reproduce
Create a BrowserWindow with a fixed height and log the height before and after minimising/restoring on a Windows machine.
Additional Information
This issue has cropped up multiple times on different projects, on any Windows machine. I've tested it on other platforms and it doesn't happen.
👋 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.
Activity
welcome commentedon Feb 12, 2019
👋 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.
360noscope commentedon May 27, 2019
About to submit new issue but i see this and i also facing this issue as well
OS Windows 10 build 1809
Electron Version 5.0.0
sataqi commentedon Jul 31, 2019
Temporary workaround until the issue is resolved:
Save your
heightandwidthin a global variable and manually set the size of window onrestoreevent.Related: #13043