How to prevent the button background darkening after closing a popover? The attached gif shows the button becoming darker before it resets to glass.
Here is the code for the button and the popover:
struct CustomMenuView<Label: View, Content: View>: View {
@ViewBuilder var label: Label
@ViewBuilder var content: Content
@State private var isExpanded: Bool = false
@Namespace private var namespace
var body: some View {
Button {
isExpanded.toggle()
} label: {
label.matchedTransitionSource(id: "MENUCONTENT", in: namespace)
}
.popover(isPresented: $isExpanded) {
content
.navigationTransition(.zoom(sourceID: "MENUCONTENT", in: namespace)).presentationCompactAdaptation(.popover)
}
}
}
And here is where I use the button:
struct SelectorMenu: View {
@Binding var selectedLeague: League
private let leagues: [League] = [.nfl, .mlb, .nba]
var body: some View {
CustomMenuView() {
buttonLabel
} content: {
menuView
}
}
@ViewBuilder
private var buttonLabel: some View {
Text("Button")
}
@ViewBuilder
private var menuView: some View {
VStack {
Text("MENU ITEM 1")
Divider()
Text("MENU ITEM 2")
Divider()
Text("MENU ITEM 3")
Divider()
Text("MENU ITEM 4")
Divider()
Text("MENU ITEM 5")
}
.padding()
}
}
I have tried changing the background color of the popover like this:
struct CustomMenuView<Label: View, Content: View>: View {
@ViewBuilder var label: Label
@ViewBuilder var content: Content
@State private var isExpanded: Bool = false
@Namespace private var namespace
var body: some View {
Button {
isExpanded.toggle()
} label: {
label.matchedTransitionSource(id: "MENUCONTENT", in: namespace)
}
.popover(isPresented: $isExpanded) {
content
.navigationTransition(.zoom(sourceID: "MENUCONTENT", in: namespace)).presentationCompactAdaptation(.popover)
.background(.red)
}
}
}
This changes the background color of the popover once its fully expanded, but the closing animation still uses the darker material as shown in the video above.
I also tried making the presentation background clear but that didn't do anything:
struct CustomMenuView<Label: View, Content: View>: View {
@ViewBuilder var label: Label
@ViewBuilder var content: Content
@State private var isExpanded: Bool = false
@Namespace private var namespace
var body: some View {
Button {
isExpanded.toggle()
} label: {
label.matchedTransitionSource(id: "MENUCONTENT", in: namespace)
}
.popover(isPresented: $isExpanded) {
content
.navigationTransition(.zoom(sourceID: "MENUCONTENT", in: namespace)).presentationCompactAdaptation(.popover)
.presentationBackground(.clear)
}
}
}

Menu? With iOS 26, the menu label morphs into the menu popover without any extra effort needed.ToolbarItemthen you don't need the.matchedTransitionSourceor.navigationTransition, which means you don't need theNamespaceeither. You can get rid of them all and it still works the same. So the undesired darkening effect is coupled with the presentation of the.popoveritself. Using a custom popover would be a way to solve.