|
5 | 5 | @use 'sass:math'; |
6 | 6 |
|
7 | 7 | [type='checkbox'] { |
8 | | - display: inline-block; |
9 | 8 | position: relative; |
| 9 | + top: calc(settings.$gap / 2); |
10 | 10 | flex-shrink: 0; |
11 | 11 | width: 1em; |
12 | 12 | height: 1em; |
13 | 13 | margin: settings.$gap; |
| 14 | + outline-offset: 0; |
14 | 15 | font-size: settings.$size; |
15 | | - vertical-align: middle; |
16 | 16 | cursor: pointer; |
17 | 17 | appearance: none; |
18 | | - top: calc(settings.$gap / 2); |
19 | | - |
20 | | - &:focus-visible { |
21 | | - outline: focus.$outline-color solid focus.$outline-width; |
22 | | - outline-offset: focus.$outline-offset; |
23 | | - } |
24 | 18 | } |
25 | 19 |
|
26 | 20 | @supports (-webkit-appearance: none) or (-moz-appearance: none) or |
|
35 | 29 | &:hover, |
36 | 30 | &:focus { |
37 | 31 | border-color: settings.$border-color-hover; |
38 | | - outline: none; |
| 32 | + outline-width: 0; |
39 | 33 | background-color: settings.$background-color-hover; |
40 | 34 | box-shadow: settings.$box-shadow-hover; |
41 | 35 | color: settings.$color-hover; |
42 | 36 | } |
43 | 37 |
|
| 38 | + &:focus-visible { |
| 39 | + outline: focus.$outline-color solid focus.$outline-width; |
| 40 | + outline-offset: focus.$outline-offset; |
| 41 | + } |
| 42 | + |
44 | 43 | &:active { |
45 | 44 | border-color: settings.$border-color-active; |
46 | 45 | background-color: settings.$background-color-active; |
|
57 | 56 | transition: opacity math.div(animation.$transition-duration, 2) |
58 | 57 | animation.$transition-duration animation.$transition-easing, |
59 | 58 | transform math.div(animation.$transition-duration, 2) |
60 | | - animation.$transition-duration animation.$transition-easing; |
| 59 | + animation.$transition-duration animation.$transition-easing, |
| 60 | + outline-offset animation.$transition-duration |
| 61 | + animation.$transition-easing; |
61 | 62 | opacity: 0; |
62 | 63 | background-image: settings.$background-image-checked; |
63 | 64 | background-repeat: no-repeat; |
|
77 | 78 | } |
78 | 79 | } |
79 | 80 |
|
80 | | - &:checked:hover, |
81 | | - &:checked:focus { |
82 | | - border-color: settings.$border-color-checked-hover; |
83 | | - background-color: settings.$background-color-checked-hover; |
84 | | - box-shadow: settings.$box-shadow-checked-hover; |
85 | | - color: settings.$color-checked-hover; |
86 | | - } |
87 | | - |
88 | | - &:checked:active { |
89 | | - border-color: settings.$border-color-checked-active; |
90 | | - background-color: settings.$background-color-checked-active; |
91 | | - box-shadow: settings.$box-shadow-checked-active; |
92 | | - color: settings.$color-checked-active; |
93 | | - } |
94 | | - |
95 | 81 | &:invalid, |
96 | 82 | &[aria-invalid='true'] { |
97 | 83 | border-color: settings.$border-color-invalid; |
|
113 | 99 | color: settings.$color-disabled-checked; |
114 | 100 | } |
115 | 101 | } |
| 102 | + |
| 103 | + &:checked:hover:not(:invalid), |
| 104 | + &:checked:focus:not(:invalid), |
| 105 | + &:checked:hover:not([aria-invalid='true']), |
| 106 | + &:checked:focus:not([aria-invalid='true']) { |
| 107 | + border-color: settings.$border-color-checked-hover; |
| 108 | + background-color: settings.$background-color-checked-hover; |
| 109 | + box-shadow: settings.$box-shadow-checked-hover; |
| 110 | + color: settings.$color-checked-hover; |
| 111 | + } |
| 112 | + |
| 113 | + &:checked:active:not(:invalid), |
| 114 | + &:checked:active:not([aria-invalid='true']) { |
| 115 | + border-color: settings.$border-color-checked-active; |
| 116 | + background-color: settings.$background-color-checked-active; |
| 117 | + box-shadow: settings.$box-shadow-checked-active; |
| 118 | + color: settings.$color-checked-active; |
| 119 | + } |
116 | 120 | } |
117 | 121 | } |
0 commit comments