From ab61e8ab3d0ec77cdb00cbd52a9ae6de4c45ae62 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 15 Apr 2026 20:09:17 +0100 Subject: [PATCH] Fix the space filters button on iPad using a Toggle for default styling. --- .../Screens/HomeScreen/View/HomeScreen.swift | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift index 2a52b9504..f09544a44 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift @@ -131,33 +131,18 @@ struct HomeScreen: View { var action: () -> Void var body: some View { - if #available(iOS 26, *) { - if selected { - content - .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: { + // Use a Toggle to let the system handle the selection style for both the Liquid Glass + // button on iPhone, along with the plain button used in the sidebar on iPad/Mac. + Toggle(isOn: .constant(selected)) { 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) - .accessibilityAddTraits(selected ? .isSelected : []) .accessibilityIdentifier(A11yIdentifiers.homeScreen.spaceFilters) } }