electron/electron

[Bug]: browserwindow cannot be positioned over mac topbar (menubar)

tianjunnew opened this issue · 1 comments

Preflight Checklist

Electron Version

26.6.10

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

if win.setAlwaysOnTop(true, 'screen-saver'), then win.setPosition / win.setBounds can position the window overlap the menubar without entering fullscreen mode

Actual Behavior

win.setPosition(0, 0) / win.setBounds({ x: 0, y: 0 }) cannot position the window overlap the menubar ( y is reset to the menubar's height), even if win.setAlwaysOnTop(true, 'screen-saver')

Testcase Gist URL

No response

Additional Information

No response

Unfortunately, the behavior you're observing is due to the way macOS handles window positioning. When you manually drag a window, macOS allows you to position it in a way that partially obscures the menu bar as long as it has a window level that enables that. However, programmatically setting a window's position respects the boundaries of the screen, excluding the menu bar. There's not really anything we can do about this.