Fix overlay stuck visible on rapid Fn presses - #43
Merged
Conversation
Repro: pressing Fn rapidly leaves the recording overlay on screen. Cause: OverlayWindowController.hide() starts a 0.14s fade-out whose completion handler tears the panel down (orderOut + nil contentViewController + panel = nil). If a new show() arrives during that fade (rapid toggle), it reuses the still- present panel — then the OLD fade-out completion fires and destroys the panel the new session is showing, desyncing `panel` from what's on screen and from AppState.overlayIsVisible, so the next hideOverlayNow() no-ops (panel already nil) while a window stays visible. Fix: a generation counter bumped on every show()/hide(). The fade-out completion only tears down if its generation is still current; a show()/hide() that arrives after cancels the teardown. show() no longer hard-resets alpha to 0 (only a freshly-created panel starts at 0), so a reused mid-fade panel animates back up from its current alpha instead of flashing. Animation/timing code (NSAnimationContext) can't be unit-tested without a window server; verified by build + reasoning. swift test 92/92; builds clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Repro: pressing Fn rapidly leaves the recording overlay on screen.
Cause:
OverlayWindowController.hide()'s fade-out completion tears the panel down. If a newshow()arrives mid-fade (rapid toggle), it reuses the panel, then the stale completion destroys the panel the new session is showing — desyncingpanelfrom the screen and fromoverlayIsVisible, so the next hide no-ops while a window stays up.Fix: a generation counter; the fade-out teardown only runs if no show()/hide() happened after it started. show() also no longer hard-resets alpha (only a fresh panel starts at 0), so a reused mid-fade panel animates smoothly back up.
Animation/timing code can't be unit-tested without a window server; verified by build + reasoning.
swift test92/92.🤖 Generated with Claude Code