Skip to content

trafficLightPosition buttons flash at (0,0) on minimize/restore (macOS) #50099

@rubywwwilde

Description

@rubywwwilde

Preflight Checklist

Electron Version

40.7.0

What operating system(s) are you using?

macOS

Operating System Version

MacOS 26.2

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Does the issue also appear in Chromium / Google Chrome?

No

Expected Behavior

When a window with titleBarStyle: 'hiddenInset' and trafficLightPosition: { x: 31, y: 26 } is minimized and then restored (via dock click or app.on('activate')), the native traffic light buttons (close, minimize, fullscreen) should appear at the configured position (31, 26) immediately, without any visible movement or repositioning during the restore animation.

Actual Behavior

When the window is restored from minimization, the traffic light buttons briefly appear at position (0, 0) — the top-left corner of the window frame — instead of the configured trafficLightPosition. After approximately 1 second, they jump to the correct configured position (31, 26). This creates a visible flash and repositioning artifact during the restore animation.

Testcase Gist URL

https://gist.github.com/rubywwwilde/031350b7c4d91f5afc0e2cff51bb6173

Additional Information

  • Electron Fiddle itself exhibits the same bug — traffic lights flash at (0, 0) on minimize/restore
  • titleBarOverlay: { height } alone does not fix it
  • setWindowButtonPosition() in restore/show/focus event handlers does not fix it (fires too late)
  • Hiding buttons before minimize with setWindowButtonVisibility(false) does not fix it
  • The flash occurs on every minimize/restore cycle

Workaround: Calling win.show() in the activate handler forces a state transition that avoids the flash:

app.on('activate', () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow()
  } else if (win) {
    win.show()
  }
})

This was discovered by reducing Mattermost Desktop's behavior — their activation/show path prevented the flash.

This report was written with the help of AI, though I read every piece of it, it may contain errors.

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions