Skip to content

Commit 5b7de2e

Browse files
author
Luke Bowerman
authored
Correct ButtonOutline inferred background color (#669)
Bug in usage of semanticColors in ButtonOutline caused an issue where the underlying HTML element could influence the rendering. Properly referencing semanticColor structure corrects this bug.
1 parent 3e7c4ee commit 5b7de2e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/components/src/Button/ButtonOutline.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ButtonBase } from './ButtonBase'
2929

3030
export const ButtonOutline = styled(ButtonBase)`
3131
background: ${({ theme, color = 'primary' }) =>
32-
theme.colors.semanticColors[color].white};
32+
theme.colors.semanticColors[color].text};
3333
border: 1px solid
3434
${({ theme, color = 'primary' }) =>
3535
theme.colors.semanticColors[color].borderColor};
@@ -40,7 +40,7 @@ export const ButtonOutline = styled(ButtonBase)`
4040
&:focus,
4141
&.hover {
4242
background: ${({ theme, color = 'primary' }) =>
43-
theme.colors.semanticColors[color].white};
43+
theme.colors.semanticColors[color].text};
4444
border-color: ${({ theme, color = 'primary' }) =>
4545
theme.colors.semanticColors[color].main};
4646
color: ${({ theme, color = 'primary' }) =>
@@ -62,7 +62,7 @@ export const ButtonOutline = styled(ButtonBase)`
6262
&:active,
6363
&:focus {
6464
background-color: ${({ theme, color = 'primary' }) =>
65-
theme.colors.semanticColors[color].white};
65+
theme.colors.semanticColors[color].text};
6666
border-color: ${({ theme, color = 'primary' }) =>
6767
theme.colors.semanticColors[color].borderColor};
6868
color: ${({ theme, color = 'primary' }) =>

packages/components/src/Button/__snapshots__/ButtonOutline.test.tsx.snap

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ exports[`ButtonOutline Focus: renders outline when tabbing into focus, but not w
3737
}
3838
3939
.c1 {
40+
background: #FFFFFF;
4041
border: 1px solid #C1C6CC;
4142
color: #6C43E0;
4243
}
4344
4445
.c1:hover,
4546
.c1:focus,
4647
.c1.hover {
48+
background: #FFFFFF;
4749
border-color: #6C43E0;
4850
color: #412399;
4951
}
@@ -58,6 +60,7 @@ exports[`ButtonOutline Focus: renders outline when tabbing into focus, but not w
5860
.c1[disabled]:hover,
5961
.c1[disabled]:active,
6062
.c1[disabled]:focus {
63+
background-color: #FFFFFF;
6164
border-color: #C1C6CC;
6265
color: #6C43E0;
6366
}
@@ -71,7 +74,7 @@ exports[`ButtonOutline Focus: renders outline when tabbing into focus, but not w
7174

7275
exports[`ButtonOutline Focus: renders outline when tabbing into focus, but not when clicking 2`] = `
7376
<button
74-
class="sc-bxivhb deKSKn sc-ifAKCX sc-EHOje dFdbyE"
77+
class="sc-bxivhb deKSKn sc-ifAKCX sc-EHOje iGIddR"
7578
>
7679
focus
7780
</button>
@@ -114,13 +117,15 @@ exports[`ButtonOutline has the correct style 1`] = `
114117
}
115118
116119
.c1 {
120+
background: #FFFFFF;
117121
border: 1px solid #C1C6CC;
118122
color: #6C43E0;
119123
}
120124
121125
.c1:hover,
122126
.c1:focus,
123127
.c1.hover {
128+
background: #FFFFFF;
124129
border-color: #6C43E0;
125130
color: #412399;
126131
}
@@ -135,6 +140,7 @@ exports[`ButtonOutline has the correct style 1`] = `
135140
.c1[disabled]:hover,
136141
.c1[disabled]:active,
137142
.c1[disabled]:focus {
143+
background-color: #FFFFFF;
138144
border-color: #C1C6CC;
139145
color: #6C43E0;
140146
}

0 commit comments

Comments
 (0)