diff --git a/.changeset/neat-ligers-burn.md b/.changeset/neat-ligers-burn.md new file mode 100644 index 0000000000..f0e368191c --- /dev/null +++ b/.changeset/neat-ligers-burn.md @@ -0,0 +1,6 @@ +--- +'@commercetools-uikit/checkbox-input': patch +'@commercetools-uikit/radio-input': patch +--- + +The focus outline for checkbox and radio labels is now only visible to keyboard users. diff --git a/packages/components/inputs/checkbox-input/src/checkbox-input.tsx b/packages/components/inputs/checkbox-input/src/checkbox-input.tsx index dee3dd6255..e825d6e78a 100644 --- a/packages/components/inputs/checkbox-input/src/checkbox-input.tsx +++ b/packages/components/inputs/checkbox-input/src/checkbox-input.tsx @@ -210,7 +210,7 @@ const Label = styled.label` }}; position: relative; - &:focus-within ${LabelTextWrapper} { + &:focus-within:has(:focus-visible) ${LabelTextWrapper} { box-shadow: 0 0 0 2px ${designTokens.borderColorForInputWhenFocused}; } diff --git a/packages/components/inputs/radio-input/src/radio-option.styles.ts b/packages/components/inputs/radio-input/src/radio-option.styles.ts index cc8eccff1c..4b3573da9b 100644 --- a/packages/components/inputs/radio-input/src/radio-option.styles.ts +++ b/packages/components/inputs/radio-input/src/radio-option.styles.ts @@ -155,7 +155,7 @@ const RadioOptionLabel = styled.label` ${(props) => !props.isReadOnly - ? `:focus-within ${LabelTextWrapper} { + ? `:focus-within:has(:focus-visible) ${LabelTextWrapper} { outline: auto 2px ${designTokens.borderColorForInputWhenFocused}; outline-offset: 2px; width: fit-content;