fix(desktop): clear stuck always-on-top after first show on windows - #46305
Open
CannonRS wants to merge 1 commit into
Open
fix(desktop): clear stuck always-on-top after first show on windows#46305CannonRS wants to merge 1 commit into
CannonRS wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #46304
Type of change
What does this PR do?
packages/desktop/src/main/windows.tsshows the main window inside theready-to-showhandler. On Win32, frameless windows can latch into thetopmost Z-order level on that first show even though the app never called
setAlwaysOnTop(true). The window then behaves as permanently-on-top,covering every other application the user brings to focus.
This PR adds a single
if (process.platform === "win32") win.setAlwaysOnTop(false)line after
win.show()inside the same handler.setAlwaysOnTop(false)isthe documented Win32 fix: it clears the latch without affecting any future
deliberate always-on-top request (the desktop does not currently set
always-on-top itself).
The change is gated on
process.platform === "win32"because the latch is aWin32-only behaviour; on macOS and Linux the call is unnecessary and is
skipped to avoid touching the platform layer.
How did you verify your code works?
packages/desktop/src/main/windows.ts.bun typecheckinpackages/desktoppasses (tsgo -bexit 0) afterbun install --ignore-scriptsin the worktree, againstupstream/devhead
10765ff2a9plus this commit.createMainWindowis the only place in thedesktop main process that handles the first show; the new line is
sequenced immediately after
win.show()inside theready-to-showcallback, so it runs exactly once per window.
This worktree and the dev container run on a non-Windows host, so a
physical Windows 10/11 reproduce-and-fix cycle is not possible here. The
fix is a 1-line API call inside a
process.platform === "win32"branchand follows the documented Win32 recovery for the topmost-Z-order latch.
A maintainer with a Windows host should confirm before merge that the
Z-order latch reproduces on a vanilla
devbuild and is cleared by thenew call.
Screenshots / recordings
N/A — no UI code path on this branch, the change is platform-conditional
setAlwaysOnTop(false)inside the desktop main process.Checklist
bun typecheckinpackages/desktoppasses (tsgo -bexit 0) afterbun install --ignore-scriptsin the worktree, againstupstream/devhead
10765ff2a9plus this commit. Windows runtime verification isblocked in this environment; see "How did you verify your code works?"