diff --git a/.changeset/quick-ravens-dance.md b/.changeset/quick-ravens-dance.md new file mode 100644 index 0000000000..a818592fb0 --- /dev/null +++ b/.changeset/quick-ravens-dance.md @@ -0,0 +1,5 @@ +--- +"@channel.io/bezier-react": patch +--- + +Add focused style to `Button` component. diff --git a/packages/bezier-react/src/components/Button/Button.styled.ts b/packages/bezier-react/src/components/Button/Button.styled.ts index 524003c5da..49616bde7d 100644 --- a/packages/bezier-react/src/components/Button/Button.styled.ts +++ b/packages/bezier-react/src/components/Button/Button.styled.ts @@ -420,6 +420,14 @@ export const ButtonWrapper = styled.button` outline: none; opacity: ${({ disabled }) => (disabled ? DisabledOpacity : 1)}; + &:focus:not(:disabled) { + box-shadow: 0 0 0 3px var(--bgtxt-cobalt-light); + } + + &:focus:not(:focus-visible) { + box-shadow: none; + } + ${({ foundation }) => foundation?.transition?.getTransitionsCSS(['background-color', 'box-shadow'])}; ${getSizeCSSFromButtonSize} diff --git a/packages/bezier-react/src/components/Button/Button.tsx b/packages/bezier-react/src/components/Button/Button.tsx index e218268ae0..e2200493fb 100644 --- a/packages/bezier-react/src/components/Button/Button.tsx +++ b/packages/bezier-react/src/components/Button/Button.tsx @@ -236,6 +236,7 @@ export const Button = forwardRef(function Button( colorVariant={colorVariant} text={text} data-testid={testId} + data-component="BezierButton" onClick={handleClick} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} diff --git a/packages/bezier-react/src/components/Button/__snapshots__/Button.test.tsx.snap b/packages/bezier-react/src/components/Button/__snapshots__/Button.test.tsx.snap index aba9191fc5..08768ae5ca 100644 --- a/packages/bezier-react/src/components/Button/__snapshots__/Button.test.tsx.snap +++ b/packages/bezier-react/src/components/Button/__snapshots__/Button.test.tsx.snap @@ -60,6 +60,14 @@ exports[`Button Test > Active Test > Active prop change Button to hover style 1` background-color: #4E40C9; } +.c0:focus:not(:disabled) { + box-shadow: 0 0 0 3px var(--bgtxt-cobalt-light); +} + +.c0:focus:not(:focus-visible) { + box-shadow: none; +} + .c0:hover { background-color: #4E40C9; } @@ -82,6 +90,7 @@ exports[`Button Test > Active Test > Active prop change Button to hover style 1`