Repository navigation
fix: keep a clicked popup open when glass draws behind its widget - #115
Merged
Merged
Conversation
GlassBackground switched between two view branches whenever a widget's background appeared or disappeared, such as when the pointer left a widget with a hover background or its popup's open state set one. With Liquid Glass on, SwiftUI rebuilt the widget, dismantled its popup anchor and closed the popup. Glass now keeps one view structure and uses the identity glass while the color is transparent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Seb-GRAF
enabled auto-merge
October 20, 2026 09:13
Collaborator
|
Thanks for the PR ❤️ |
Seb-GRAF
added a commit
that referenced
this pull request
Oct 20, 2026
fix: keep a clicked popup open when glass draws behind its widget
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
With Liquid Glass on (
bar.glass.enabled), a popup opened by clicking a widget closes as soon as the pointer leaves the widget, so it can't be reached. It happens with any theme where a widget's background comes and goes, such as the menu-bar theme'shoverBackgroundwith no resting background, or a background set only in theopenstate. With glass off, the popup stays open.Changes
GlassBackgroundpicked one of two view branches depending on whether the current color is visible: glass plus a color layer, or a plain background. Hover, open and data states change that color, so with glass on the modifier switched branches whenever the pointer entered or left a widget. SwiftUI then rebuilt the widget's subtree and dismantled itsPopupAnchor, anddismantleNSView→WidgetPopup.removeAnchorclosed the popup, even though it was pinned by the click.With glass on, the modifier now keeps one view structure: it draws
Glass.identitywhile the color is transparent and clear glass once it shows, with the color layer on top as before. The branch only depends on the macOS version and the glass settings, which don't change while the pointer moves. A transparent color still draws nothing, and a visible one draws exactly as before.A side effect: hovering a widget with glass on no longer rebuilds its content each time the pointer enters or leaves it.
Testing
WidgetPopup.close()with its call stack) and ran it on a scratch copy of a real configuration (menu-bar theme, glass on, a script widget with a popup) on macOS 26.6.2:PopupAnchor.dismantleNSView→removeAnchor→close(), and anchors were dismantled on almost every hover change.dismissOnAction). No anchor was dismantled after launch.clickedPopupStaysOpenWhenItsWidgetBackgroundChanges(glass:): a widget whose only background comes from itsopenstate, clicked in an offscreen bar. It fails without the fix forglass: true(the popup closes and loses its anchor) and passes with it;glass: falsepasses either way.swift test: 327 tests pass on current main.Glass.identitydraws no effect, and visible colors take the same glass and color layers as before.Merging
One commit; any merge method keeps it in the changelog.
Claude Opus 5.5 via Claude Code
🤖 Generated with Claude Code