Fix the space filters button on iPad using a Toggle for default styling.

This commit is contained in:
Doug
2026-04-15 20:09:17 +01:00
committed by Doug
parent 30593909de
commit ab61e8ab3d
@@ -131,33 +131,18 @@ struct HomeScreen: View {
var action: () -> Void var action: () -> Void
var body: some View { var body: some View {
if #available(iOS 26, *) { // Use a Toggle to let the system handle the selection style for both the Liquid Glass
if selected { // button on iPhone, along with the plain button used in the sidebar on iPad/Mac.
content Toggle(isOn: .constant(selected)) {
.backportButtonStyleGlassProminent()
.tint(.compound.bgActionPrimaryRest)
} else {
content
}
} else {
if selected {
content
.buttonStyle(.compound(.primary, size: .toolbarIcon))
} else {
content
.buttonStyle(.compound(.tertiary, size: .toolbarIcon))
}
}
}
private var content: some View {
Button {
action()
} label: {
CompoundIcon(\.filter) CompoundIcon(\.filter)
.foregroundStyle(selected ? .compound.iconOnSolidPrimary : .compound.iconPrimary)
}
.overlay {
// The tap gesture is ignored when applied to the toggle so apply it to an overlay instead.
Color.black.opacity(0.001)
.onTapGesture(perform: action)
} }
.accessibilityLabel(L10n.screenRoomlistYourSpaces) .accessibilityLabel(L10n.screenRoomlistYourSpaces)
.accessibilityAddTraits(selected ? .isSelected : [])
.accessibilityIdentifier(A11yIdentifiers.homeScreen.spaceFilters) .accessibilityIdentifier(A11yIdentifiers.homeScreen.spaceFilters)
} }
} }