fix: ignore transient post-show blur on Windows tray click - #115
Merged
Conversation
Clicking the tray icon on Windows keeps the shell (explorer.exe) as the foreground process, so the popup's show() cannot pull focus and Windows immediately fires a blur. The 100ms auto-hide timer then fires before the first paint and the window never visibly appears. Ignore blur events that land within a short grace window right after a show; a genuine click-away arrives well after it. Gated to win32 so macOS/Linux behaviour is unchanged. Ref: gitify-app/gitify#3064
This was referenced Jul 27, 2026
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.
Problem
On Windows, gitify v7 users report that clicking the tray icon does nothing: the app runs in the background (notifications fire, the icon is colored) but the popup window never appears, with no errors logged. See gitify-app/gitify#3064.
Root cause
Clicking a tray icon on Windows keeps the shell (
explorer.exe) as the foreground process. Because of Windows' foreground-activation lock, the popup'sshow()cannot pull focus to itself, so the window immediately receives ablur. The existing blur handler schedules the 100 ms auto-hide, which fires before the first paint, and the window hides itself again. Net effect: the click appears to do nothing.This is timing-sensitive, which is why it reproduces on some Windows setups and not in CI (headless runners have no real shell/foreground contention).
Fix
Ignore
blurevents that land within a short grace window (400 ms) immediately after ashow(). A genuine click-away arrives well after the popup has settled, so it still auto-hides as before. The guard is gated towin32, so macOS and Linux behaviour is unchanged.Also split the pre-existing
isAlwaysOnTop() ? … : …ternary into explicitifbranches so the new early-return reads cleanly; the pinned/focus-lostpath is unchanged.Tests
Added a
blur-to-hide behaviorsuite covering:alwaysOnTopstill emitsfocus-lostinstead of hidingVerified the Windows test fails if the guard is removed.
pnpm test(72 passing),pnpm typecheck, andpnpm lint:checkare all green.Downstream
Once released, bump
electron-menubarin gitify and the app-level workaround in gitify-app/gitify#3082 can be dropped in favor of this source fix.