From 9b3f28cd76d3b5d88008835ef370a64842b68cb2 Mon Sep 17 00:00:00 2001 From: Cassio Rossi Date: Thu, 23 Jul 2026 22:39:17 +0100 Subject: [PATCH] fix(#274): make full 44pt toolbar button circle tappable The frame/contentShape in minimumTouchTarget was applied outside the Button, so only the small icon label was hit-testable while the interactive glass circle gave press feedback for the whole 44pt area. Taps landing off the icon animated but never fired the action (FB22155477). Moving the frame/contentShape into a ButtonStyle places the 44pt circle inside the button's hit-test region for Button and ShareLink alike. Co-Authored-By: Claude --- .../Cards/Extensions/MinimumTouchTarget.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MacMagazine/Features/MacMagazineUILibrary/Sources/MacMagazineUILibrary/Cards/Extensions/MinimumTouchTarget.swift b/MacMagazine/Features/MacMagazineUILibrary/Sources/MacMagazineUILibrary/Cards/Extensions/MinimumTouchTarget.swift index a4ff1097..412f1680 100644 --- a/MacMagazine/Features/MacMagazineUILibrary/Sources/MacMagazineUILibrary/Cards/Extensions/MinimumTouchTarget.swift +++ b/MacMagazine/Features/MacMagazineUILibrary/Sources/MacMagazineUILibrary/Cards/Extensions/MinimumTouchTarget.swift @@ -15,9 +15,19 @@ private struct MinimumTouchTarget: ViewModifier { func body(content: Content) -> some View { content - .buttonStyle(.plain) + .buttonStyle(MinimumTouchTargetButtonStyle()) + .glassEffect(.regular.tint(selected ? selectedColor.opacity(0.3) : .clear).interactive(), in: .circle) + } +} + +/// Expands the tappable area from inside the button so the full 44pt circle +/// receives taps — a `frame`/`contentShape` applied outside a `Button` only +/// resizes the visual glass, not the button's hit-test region (FB22155477). +private struct MinimumTouchTargetButtonStyle: ButtonStyle { + func makeBody(configuration: Configuration) -> some View { + configuration.label .frame(width: 44, height: 44) .contentShape(Circle()) - .glassEffect(.regular.tint(selected ? selectedColor.opacity(0.3) : .clear).interactive(), in: .circle) + .opacity(configuration.isPressed ? 0.4 : 1) } }