From 51985332420530e3a0fbb32979dffc36092f328e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Wischer?= Date: Tue, 14 Jul 2026 22:38:20 +0200 Subject: [PATCH] Add a visible custom focus ring to the standard button style --- .../Sources/Compound/BaseStyles/CompoundButtonStyle.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift b/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift index 5b41a1da6..a186c7c72 100644 --- a/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift +++ b/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift @@ -22,6 +22,7 @@ public struct CompoundButtonStyle: ButtonStyle { @Environment(\.isEnabled) private var isEnabled @Environment(\.colorScheme) private var colorScheme @Environment(\.accessibilityShowButtonShapes) private var accessibilityShowButtonShapes + @Environment(\.isFocused) private var isFocused var kind: Kind public enum Kind { @@ -117,6 +118,11 @@ public struct CompoundButtonStyle: ButtonStyle { makeBackground(configuration: configuration) } .contentShape(contentShape) + .overlay { + if isFocused { + contentShape.stroke(.compound.borderInteractivePrimary, lineWidth: 2) + } + } } @ViewBuilder