fix: recreate popup backdrop for each presentation

This commit is contained in:
2026-10-18 01:47:50 +02:00
parent ffad1cf4e6
commit c52c3b227e
2 changed files with 28 additions and 6 deletions
@@ -5,6 +5,7 @@ import ConjureKit
final class ApplicationActionsController: NSViewController, NSSearchFieldDelegate {
private let search = ActionsSearchField()
private let background = LauncherBackground(frame: .zero)
private var material: NSVisualEffectView?
private let entries = [
ActionEntry(title: "Open", symbol: "arrow.up.forward.app", color: SunsetPalette.text),
ActionEntry(title: "Favorite", symbol: "star", color: SunsetPalette.text),
@@ -58,11 +59,10 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
view.layer?.shadowOpacity = 0.35
view.layer?.shadowRadius = 14
view.layer?.shadowOffset = NSSize(width: 0, height: -4)
let content = NSVisualEffectView()
content.material = .hudWindow
content.blendingMode = .behindWindow
content.state = .active
roundMaterialCorners(content, radius: 18)
let content = NSView()
content.wantsLayer = true
content.layer?.cornerRadius = 18
content.layer?.masksToBounds = true
content.layer?.borderWidth = 0.5
background.setAccessibilityElement(false)
content.addSubview(background)
@@ -213,6 +213,24 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
coveredPillAlpha = pill.alphaValue
}
coveredPill?.setAccessibilityHidden(true)
// A backdrop belongs to one presentation; do not move a cached native material
// between the footer Actions popup and the header provider popup.
material?.removeFromSuperview()
let backdrop = NSVisualEffectView()
backdrop.material = .hudWindow
backdrop.blendingMode = .behindWindow
backdrop.state = .active
roundMaterialCorners(backdrop, radius: 18)
backdrop.translatesAutoresizingMaskIntoConstraints = false
let content = background.superview!
content.addSubview(backdrop, positioned: .below, relativeTo: background)
NSLayoutConstraint.activate([
backdrop.leadingAnchor.constraint(equalTo: content.leadingAnchor),
backdrop.trailingAnchor.constraint(equalTo: content.trailingAnchor),
backdrop.topAnchor.constraint(equalTo: content.topAnchor),
backdrop.bottomAnchor.constraint(equalTo: content.bottomAnchor),
])
material = backdrop
host.layoutSubtreeIfNeeded()
background.needsDisplay = true
NSAnimationContext.runAnimationGroup { context in
@@ -247,6 +265,8 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
coveredPill?.setAccessibilityHidden(false)
if !animated {
view.removeFromSuperview()
material?.removeFromSuperview()
material = nil
coveredPill?.layer?.removeAllAnimations()
coveredPill?.alphaValue = coveredPillAlpha
coveredPill = nil
@@ -263,6 +283,8 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
MainActor.assumeIsolated {
guard self.transitionGeneration == generation, self.isClosing else { return }
self.view.removeFromSuperview()
self.material?.removeFromSuperview()
self.material = nil
self.coveredPill = nil
self.isClosing = false
}