Skip to content

Commit 7e58e69

Browse files
authored
fix(colorpickers): ColorSwatch focus styling (#1726)
* fix(colorpickers): `ColorSwatch` focus styling * Fix cell content positioning
1 parent 6844b7a commit 7e58e69

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/colorpickers/src/styled/ColorSwatch/StyledColorSwatchInput.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const StyledColorSwatchInput = styled.input.attrs({
2121
opacity: 0;
2222
z-index: 1;
2323
margin: 0;
24+
cursor: pointer;
2425
width: 100%;
2526
height: 100%;
2627

packages/colorpickers/src/styled/ColorSwatch/StyledColorSwatchLabel.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import styled, { DefaultTheme, ThemeProps } from 'styled-components';
99
import { parseToRgb, readableColor } from 'polished';
10-
import { DEFAULT_THEME, getColor, retrieveComponentStyles } from '@zendeskgarden/react-theming';
10+
import { DEFAULT_THEME, focusStyles, retrieveComponentStyles } from '@zendeskgarden/react-theming';
1111
import { StyledButtonPreview } from '../ColorPickerDialog/StyledButtonPreview';
1212
import { IRGBColor } from '../../types';
1313

@@ -18,7 +18,6 @@ interface IStyledColorSwatchLabelProps extends ThemeProps<DefaultTheme> {
1818
}
1919

2020
const colorStyles = (props: IStyledColorSwatchLabelProps) => {
21-
const boxShadow = props.theme.shadows.md(getColor('primaryHue', 600, props.theme, 0.35)!);
2221
const { alpha } = parseToRgb(props.backgroundColor) as IRGBColor;
2322
let foregroundColor;
2423

@@ -34,9 +33,6 @@ const colorStyles = (props: IStyledColorSwatchLabelProps) => {
3433

3534
return `
3635
color: ${foregroundColor};
37-
38-
&[data-garden-focus-visible] {
39-
box-shadow: ${boxShadow};
4036
`;
4137
};
4238

@@ -46,11 +42,13 @@ export const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
4642
'data-garden-version': PACKAGE_VERSION
4743
})`
4844
position: relative;
45+
top: 0;
4946
border-radius: ${props => props.theme.borderRadii.md};
50-
cursor: pointer;
5147
5248
${colorStyles};
5349
50+
${props => focusStyles({ theme: props.theme, selector: '&:has(:focus-visible)' })}
51+
5452
${props => retrieveComponentStyles(COMPONENT_ID, props)};
5553
`;
5654

0 commit comments

Comments
 (0)