Skip to content

Commit 79f2379

Browse files
committed
fix: a11y contrast issues
1 parent 1d4a190 commit 79f2379

File tree

2 files changed

+35
-47
lines changed

2 files changed

+35
-47
lines changed

pages/tabs/style-permutations.page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ const permutations = createPermutations<TabsProps>([
7373
tabs: {
7474
backgroundColor: {
7575
default: 'light-dark(#f1f5f9, #1e293b)',
76-
hover: 'light-dark(#e0e7ff, #312e81)',
77-
active: 'light-dark(#6366f1, #4f46e5)',
76+
hover: 'light-dark(#dbeafe, #1e3a8a)',
77+
active: 'light-dark(#2563eb, #1d4ed8)',
7878
disabled: 'light-dark(#f8fafc, #1e293b)',
7979
},
8080
borderColor: {
@@ -87,7 +87,7 @@ const permutations = createPermutations<TabsProps>([
8787
borderRadius: '20px',
8888
color: {
8989
default: 'light-dark(#475569, #94a3b8)',
90-
hover: 'light-dark(#4338ca, #c7d2fe)',
90+
hover: 'light-dark(#1e3a8a, #dbeafe)',
9191
active: 'light-dark(#ffffff, #ffffff)',
9292
disabled: 'light-dark(#cbd5e1, #64748b)',
9393
},
@@ -96,7 +96,7 @@ const permutations = createPermutations<TabsProps>([
9696
paddingBlock: '10px',
9797
paddingInline: '24px',
9898
focusRing: {
99-
borderColor: 'light-dark(#6366f1, #818cf8)',
99+
borderColor: 'light-dark(#2563eb, #60a5fa)',
100100
borderRadius: '22px',
101101
borderWidth: '2px',
102102
},

src/tabs/styles.tsx

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,56 @@ import customCssProps from '../internal/generated/custom-css-properties';
55
import { TabsProps } from './interfaces';
66

77
export function getTabStyles(style: TabsProps['style']) {
8-
if (SYSTEM !== 'core' || !style?.tabs) {
8+
if (SYSTEM !== 'core') {
99
return undefined;
1010
}
1111

1212
return {
13-
borderRadius: style.tabs.borderRadius,
14-
borderWidth: style.tabs.borderWidth,
15-
fontSize: style.tabs.fontSize,
16-
fontWeight: style.tabs.fontWeight,
17-
paddingBlock: style.tabs.paddingBlock,
18-
paddingInline: style.tabs.paddingInline,
19-
...(style.tabs.backgroundColor && {
20-
[customCssProps.styleBackgroundActive]: style.tabs.backgroundColor.active,
21-
[customCssProps.styleBackgroundDefault]: style.tabs.backgroundColor.default,
22-
[customCssProps.styleBackgroundDisabled]: style.tabs.backgroundColor.disabled,
23-
[customCssProps.styleBackgroundHover]: style.tabs.backgroundColor.hover,
24-
}),
25-
...(style.tabs.borderColor && {
26-
[customCssProps.styleBorderColorActive]: style.tabs.borderColor.active,
27-
[customCssProps.styleBorderColorDefault]: style.tabs.borderColor.default,
28-
[customCssProps.styleBorderColorDisabled]: style.tabs.borderColor.disabled,
29-
[customCssProps.styleBorderColorHover]: style.tabs.borderColor.hover,
30-
}),
31-
...(style.tabs.color && {
32-
[customCssProps.styleColorActive]: style.tabs.color.active,
33-
[customCssProps.styleColorDefault]: style.tabs.color.default,
34-
[customCssProps.styleColorDisabled]: style.tabs.color.disabled,
35-
[customCssProps.styleColorHover]: style.tabs.color.hover,
36-
}),
37-
...(style.tabs.focusRing && {
38-
[customCssProps.styleFocusRingBorderColor]: style.tabs.focusRing.borderColor,
39-
[customCssProps.styleFocusRingBorderRadius]: style.tabs.focusRing.borderRadius,
40-
[customCssProps.styleFocusRingBorderWidth]: style.tabs.focusRing.borderWidth,
41-
}),
13+
borderRadius: style?.tabs?.borderRadius,
14+
borderWidth: style?.tabs?.borderWidth,
15+
fontSize: style?.tabs?.fontSize,
16+
fontWeight: style?.tabs?.fontWeight,
17+
paddingBlock: style?.tabs?.paddingBlock,
18+
paddingInline: style?.tabs?.paddingInline,
19+
[customCssProps.styleBackgroundActive]: style?.tabs?.backgroundColor?.active,
20+
[customCssProps.styleBackgroundDefault]: style?.tabs?.backgroundColor?.default,
21+
[customCssProps.styleBackgroundDisabled]: style?.tabs?.backgroundColor?.disabled,
22+
[customCssProps.styleBackgroundHover]: style?.tabs?.backgroundColor?.hover,
23+
[customCssProps.styleBorderColorActive]: style?.tabs?.borderColor?.active,
24+
[customCssProps.styleBorderColorDefault]: style?.tabs?.borderColor?.default,
25+
[customCssProps.styleBorderColorDisabled]: style?.tabs?.borderColor?.disabled,
26+
[customCssProps.styleBorderColorHover]: style?.tabs?.borderColor?.hover,
27+
[customCssProps.styleColorActive]: style?.tabs?.color?.active,
28+
[customCssProps.styleColorDefault]: style?.tabs?.color?.default,
29+
[customCssProps.styleColorDisabled]: style?.tabs?.color?.disabled,
30+
[customCssProps.styleColorHover]: style?.tabs?.color?.hover,
31+
[customCssProps.styleFocusRingBorderColor]: style?.tabs?.focusRing?.borderColor,
32+
[customCssProps.styleFocusRingBorderRadius]: style?.tabs?.focusRing?.borderRadius,
33+
[customCssProps.styleFocusRingBorderWidth]: style?.tabs?.focusRing?.borderWidth,
4234
};
4335
}
4436

4537
export function getTabContainerStyles(style: TabsProps['style']) {
46-
if (SYSTEM !== 'core' || (!style?.underline && !style?.divider)) {
38+
if (SYSTEM !== 'core') {
4739
return undefined;
4840
}
4941

5042
return {
51-
...(style.underline && {
52-
[customCssProps.styleTabsUnderlineColor]: style.underline.color,
53-
[customCssProps.styleTabsUnderlineWidth]: style.underline.width,
54-
[customCssProps.styleTabsUnderlineBorderRadius]: style.underline.borderRadius,
55-
}),
56-
...(style.divider && {
57-
[customCssProps.styleTabsDividerColor]: style.divider.color,
58-
[customCssProps.styleTabsDividerWidth]: style.divider.width,
59-
}),
43+
[customCssProps.styleTabsUnderlineColor]: style?.underline?.color,
44+
[customCssProps.styleTabsUnderlineWidth]: style?.underline?.width,
45+
[customCssProps.styleTabsUnderlineBorderRadius]: style?.underline?.borderRadius,
46+
[customCssProps.styleTabsDividerColor]: style?.divider?.color,
47+
[customCssProps.styleTabsDividerWidth]: style?.divider?.width,
6048
};
6149
}
6250

6351
export function getTabHeaderStyles(style: TabsProps['style']) {
64-
if (SYSTEM !== 'core' || !style?.headerDivider) {
52+
if (SYSTEM !== 'core') {
6553
return undefined;
6654
}
6755

6856
return {
69-
[customCssProps.styleTabsHeaderDividerColor]: style.headerDivider.color,
70-
[customCssProps.styleTabsHeaderDividerWidth]: style.headerDivider.width,
57+
[customCssProps.styleTabsHeaderDividerColor]: style?.headerDivider?.color,
58+
[customCssProps.styleTabsHeaderDividerWidth]: style?.headerDivider?.width,
7159
};
7260
}

0 commit comments

Comments
 (0)