File tree 1 file changed +25
-2
lines changed
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import {
10
10
createBoxStyles ,
11
11
createFlatBoxStyles ,
12
12
createDisabledTextStyles ,
13
- createHatchedBackground
13
+ createHatchedBackground ,
14
+ focusOutline
14
15
} from '../common' ;
15
16
import { blockSizes , fontSizes , padding } from '../common/system' ;
16
17
@@ -24,10 +25,20 @@ const commonButtonStyles = css`
24
25
fullWidth ? '100%' : square ? blockSizes [ size ] : 'auto' } ;
25
26
padding: ${ ( { square } ) => ( square ? 0 : `0 calc(${ padding . sm } + 2px)` ) } ;
26
27
font-size: ${ fontSizes . md } ;
28
+ user-select: none;
27
29
&:active {
28
30
padding-top: ${ ( { isDisabled } ) => ! isDisabled && '2px' } ;
29
31
}
30
32
padding-top: ${ ( { active, isDisabled } ) => active && ! isDisabled && '2px' } ;
33
+ &:after {
34
+ content: '';
35
+ position: absolute;
36
+ display: block;
37
+ top: 0;
38
+ left: 0;
39
+ height: 100%;
40
+ width: 100%;
41
+ }
31
42
` ;
32
43
33
44
export const StyledButton = styled . button `
@@ -46,12 +57,17 @@ export const StyledButton = styled.button`
46
57
outline: 2px solid transparent;
47
58
outline-offset: -4px;
48
59
` }
60
+ &:focus:after {
61
+ ${ focusOutline }
62
+ outline-offset: -6px;
63
+ }
49
64
`
50
65
: variant === 'menu'
51
66
? css `
52
67
${ createBoxStyles ( ) } ;
53
68
border: 2px solid transparent;
54
- &:hover {
69
+ &:hover,
70
+ &:focus {
55
71
${ ! isDisabled && ! active && createWellBorderStyles ( false ) }
56
72
}
57
73
&:active {
@@ -95,6 +111,13 @@ export const StyledButton = styled.button`
95
111
&:active:before {
96
112
${ ! isDisabled && createBorderStyles ( { invert : true } ) }
97
113
}
114
+ &:focus:after {
115
+ ${ focusOutline }
116
+ outline-offset: -8px;
117
+ }
118
+ &:active:focus:after {
119
+ top: ${ active ? '0' : '1px' } ;
120
+ }
98
121
` }
99
122
${ commonButtonStyles }
100
123
` ;
You can’t perform that action at this time.
0 commit comments