File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import {
1010 createBoxStyles ,
1111 createFlatBoxStyles ,
1212 createDisabledTextStyles ,
13- createHatchedBackground
13+ createHatchedBackground ,
14+ focusOutline
1415} from '../common' ;
1516import { blockSizes , fontSizes , padding } from '../common/system' ;
1617
@@ -24,10 +25,20 @@ const commonButtonStyles = css`
2425 fullWidth ? '100%' : square ? blockSizes [ size ] : 'auto' } ;
2526 padding: ${ ( { square } ) => ( square ? 0 : `0 calc(${ padding . sm } + 2px)` ) } ;
2627 font-size: ${ fontSizes . md } ;
28+ user-select: none;
2729 &:active {
2830 padding-top: ${ ( { isDisabled } ) => ! isDisabled && '2px' } ;
2931 }
3032 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+ }
3142` ;
3243
3344export const StyledButton = styled . button `
@@ -46,12 +57,17 @@ export const StyledButton = styled.button`
4657 outline: 2px solid transparent;
4758 outline-offset: -4px;
4859 ` }
60+ &:focus:after {
61+ ${ focusOutline }
62+ outline-offset: -6px;
63+ }
4964 `
5065 : variant === 'menu'
5166 ? css `
5267 ${ createBoxStyles ( ) } ;
5368 border: 2px solid transparent;
54- &:hover {
69+ &:hover,
70+ &:focus {
5571 ${ ! isDisabled && ! active && createWellBorderStyles ( false ) }
5672 }
5773 &:active {
@@ -95,6 +111,13 @@ export const StyledButton = styled.button`
95111 &:active:before {
96112 ${ ! isDisabled && createBorderStyles ( { invert : true } ) }
97113 }
114+ &:focus:after {
115+ ${ focusOutline }
116+ outline-offset: -8px;
117+ }
118+ &:active:focus:after {
119+ top: ${ active ? '0' : '1px' } ;
120+ }
98121 ` }
99122 ${ commonButtonStyles }
100123` ;
You can’t perform that action at this time.
0 commit comments