Skip to content

Commit be8cb85

Browse files
cianfoley-nearformjraff
authored andcommitted
fix(core-button): no hover on touch screens
1 parent fa71cd1 commit be8cb85

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

packages/Button/Button.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ const getVariant = ({ variant, rank }) => {
128128
border,
129129
transition,
130130
'&:hover': hover,
131+
'@media (hover: none)': {
132+
'&:hover': {
133+
boxShadow: 'none',
134+
backgroundColor,
135+
color,
136+
},
137+
},
131138
'&:active': active,
132139
'&:focus': focus,
133140
'@media (prefers-reduced-motion: reduce)': {

packages/Button/__tests__/__snapshots__/Button.spec.jsx.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ exports[`Button can be presented as one of the allowed variants 1`] = `
6666
}
6767
}
6868
69+
@media (hover:none) {
70+
.c0:hover {
71+
box-shadow: none;
72+
background-color: #4b286d;
73+
color: #fff;
74+
}
75+
}
76+
6977
@media (prefers-reduced-motion:reduce) {
7078
.c0 {
7179
-webkit-transition: none !important;
@@ -164,6 +172,14 @@ exports[`Button can be presented as one of the new allowed variants 1`] = `
164172
}
165173
}
166174
175+
@media (hover:none) {
176+
.c0:hover {
177+
box-shadow: none;
178+
background-color: #fff;
179+
color: #2B8000;
180+
}
181+
}
182+
167183
@media (prefers-reduced-motion:reduce) {
168184
.c0 {
169185
-webkit-transition: none !important;
@@ -249,6 +265,14 @@ exports[`Button renders 1`] = `
249265
}
250266
}
251267
268+
@media (hover:none) {
269+
.c0:hover {
270+
box-shadow: none;
271+
background-color: #2B8000;
272+
color: #fff;
273+
}
274+
}
275+
252276
@media (prefers-reduced-motion:reduce) {
253277
.c0 {
254278
-webkit-transition: none !important;

0 commit comments

Comments
 (0)