@primer/css 20.0.0-rc.8702fd9a → 20.0.0-rc.e6f567ec

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +166 -3
  2. package/CONTRIBUTING.md +6 -4
  3. package/DEVELOP.md +26 -21
  4. package/README.md +2 -2
  5. package/actionlist/action-list-item-divider.scss +8 -2
  6. package/actionlist/action-list-item.scss +214 -130
  7. package/actionlist/action-list-tree.scss +118 -0
  8. package/actionlist/action-list.scss +29 -0
  9. package/actionlist/index.scss +1 -0
  10. package/alerts/flash.scss +6 -2
  11. package/autocomplete/autocomplete.scss +51 -2
  12. package/avatars/avatar-stack.scss +1 -0
  13. package/base/base.scss +64 -3
  14. package/base/index.scss +0 -1
  15. package/base/kbd.scss +0 -1
  16. package/base/normalize.scss +13 -53
  17. package/base/typography-base.scss +3 -2
  18. package/blankslate/blankslate.scss +20 -1
  19. package/blankslate/index.scss +0 -1
  20. package/box/box.scss +0 -3
  21. package/branch-name/branch-name.scss +1 -0
  22. package/breadcrumb/breadcrumb.scss +1 -1
  23. package/buttons/button-group.scss +3 -2
  24. package/buttons/button.scss +64 -36
  25. package/buttons/misc.scss +30 -25
  26. package/color-modes/index.scss +2 -0
  27. package/color-modes/native.scss +12 -0
  28. package/color-modes/themes/dark.scss +0 -1
  29. package/color-modes/themes/dark_colorblind.scss +0 -1
  30. package/color-modes/themes/dark_dimmed.scss +0 -1
  31. package/color-modes/themes/dark_high_contrast.scss +0 -1
  32. package/color-modes/themes/dark_tritanopia.scss +6 -0
  33. package/color-modes/themes/light.scss +0 -1
  34. package/color-modes/themes/light_colorblind.scss +0 -1
  35. package/color-modes/themes/light_high_contrast.scss +0 -1
  36. package/color-modes/themes/light_tritanopia.scss +6 -0
  37. package/dist/actionlist.css +1 -1
  38. package/dist/actionlist.css.map +1 -1
  39. package/dist/alerts.css +1 -1
  40. package/dist/alerts.css.map +1 -1
  41. package/dist/autocomplete.css +1 -1
  42. package/dist/autocomplete.css.map +1 -1
  43. package/dist/avatars.css +1 -1
  44. package/dist/avatars.css.map +1 -1
  45. package/dist/base.css +1 -1
  46. package/dist/base.css.map +1 -1
  47. package/dist/blankslate.css +1 -1
  48. package/dist/blankslate.css.map +1 -1
  49. package/dist/box.css.map +1 -1
  50. package/dist/branch-name.css +1 -1
  51. package/dist/branch-name.css.map +1 -1
  52. package/dist/breadcrumb.css.map +1 -1
  53. package/dist/buttons.css +1 -1
  54. package/dist/buttons.css.map +1 -1
  55. package/dist/color-modes.css +1 -1
  56. package/dist/color-modes.css.map +1 -1
  57. package/dist/core.css +1 -1
  58. package/dist/core.css.map +1 -1
  59. package/dist/dropdown.css +1 -1
  60. package/dist/dropdown.css.map +1 -1
  61. package/dist/forms.css +1 -1
  62. package/dist/forms.css.map +1 -1
  63. package/dist/header.css.map +1 -1
  64. package/dist/labels.css +1 -1
  65. package/dist/labels.css.map +1 -1
  66. package/dist/layout.css +1 -1
  67. package/dist/layout.css.map +1 -1
  68. package/dist/links.css +1 -1
  69. package/dist/links.css.map +1 -1
  70. package/dist/loaders.css.map +1 -1
  71. package/dist/markdown.css +1 -1
  72. package/dist/markdown.css.map +1 -1
  73. package/dist/marketing-buttons.css +1 -1
  74. package/dist/marketing-buttons.css.map +1 -1
  75. package/dist/marketing-links.css +1 -1
  76. package/dist/marketing-links.css.map +1 -1
  77. package/dist/marketing-type.css.map +1 -1
  78. package/dist/marketing-utilities.css.map +1 -1
  79. package/dist/marketing.css +1 -1
  80. package/dist/marketing.css.map +1 -1
  81. package/dist/meta.json +73 -73
  82. package/dist/navigation.css +1 -1
  83. package/dist/navigation.css.map +1 -1
  84. package/dist/pagination.css +1 -1
  85. package/dist/pagination.css.map +1 -1
  86. package/dist/popover.css +1 -1
  87. package/dist/popover.css.map +1 -1
  88. package/dist/primer.css +4 -4
  89. package/dist/primer.css.map +1 -1
  90. package/dist/product.css +1 -1
  91. package/dist/product.css.map +1 -1
  92. package/dist/progress.css.map +1 -1
  93. package/dist/select-menu.css.map +1 -1
  94. package/dist/stats/actionlist.json +1 -1
  95. package/dist/stats/alerts.json +1 -1
  96. package/dist/stats/autocomplete.json +1 -1
  97. package/dist/stats/avatars.json +1 -1
  98. package/dist/stats/base.json +1 -1
  99. package/dist/stats/blankslate.json +1 -1
  100. package/dist/stats/branch-name.json +1 -1
  101. package/dist/stats/buttons.json +1 -1
  102. package/dist/stats/color-modes.json +1 -1
  103. package/dist/stats/core.json +1 -1
  104. package/dist/stats/dropdown.json +1 -1
  105. package/dist/stats/forms.json +1 -1
  106. package/dist/stats/labels.json +1 -1
  107. package/dist/stats/layout.json +1 -1
  108. package/dist/stats/links.json +1 -1
  109. package/dist/stats/markdown.json +1 -1
  110. package/dist/stats/marketing-buttons.json +1 -1
  111. package/dist/stats/marketing-links.json +1 -1
  112. package/dist/stats/marketing.json +1 -1
  113. package/dist/stats/navigation.json +1 -1
  114. package/dist/stats/pagination.json +1 -1
  115. package/dist/stats/popover.json +1 -1
  116. package/dist/stats/primer.json +1 -1
  117. package/dist/stats/product.json +1 -1
  118. package/dist/stats/subhead.json +1 -1
  119. package/dist/stats/toasts.json +1 -1
  120. package/dist/stats/tooltips.json +1 -1
  121. package/dist/stats/utilities.json +1 -1
  122. package/dist/subhead.css +1 -1
  123. package/dist/subhead.css.map +1 -1
  124. package/dist/table-object.css.map +1 -1
  125. package/dist/timeline.css.map +1 -1
  126. package/dist/toasts.css +1 -1
  127. package/dist/toasts.css.map +1 -1
  128. package/dist/tooltips.css +1 -1
  129. package/dist/tooltips.css.map +1 -1
  130. package/dist/truncate.css.map +1 -1
  131. package/dist/utilities.css +1 -1
  132. package/dist/utilities.css.map +1 -1
  133. package/dist/variables.json +7 -7
  134. package/dropdown/dropdown.scss +0 -2
  135. package/forms/form-control.scss +26 -5
  136. package/forms/form-group.scss +47 -13
  137. package/forms/form-validation.scss +1 -1
  138. package/forms/input-group.scss +18 -0
  139. package/labels/counters.scss +1 -1
  140. package/labels/index.scss +0 -1
  141. package/labels/labels.scss +12 -1
  142. package/labels/mixins.scss +7 -2
  143. package/labels/states.scss +2 -2
  144. package/layout/grid-offset.scss +1 -0
  145. package/layout/grid.scss +1 -0
  146. package/layout/index.scss +1 -1
  147. package/layout/layout.scss +8 -11
  148. package/layout/mixins.scss +30 -4
  149. package/layout/page-layout.scss +384 -0
  150. package/links/link.scss +6 -1
  151. package/markdown/code.scss +5 -0
  152. package/markdown/footnotes.scss +38 -26
  153. package/markdown/headings.scss +17 -0
  154. package/markdown/images.scss +3 -3
  155. package/markdown/markdown-body.scss +0 -8
  156. package/marketing/buttons/button.scss +32 -26
  157. package/marketing/links/link.scss +5 -5
  158. package/marketing/type/typography.scss +3 -0
  159. package/marketing/utilities/layout.scss +1 -0
  160. package/navigation/filter-list.scss +20 -2
  161. package/navigation/menu.scss +8 -10
  162. package/navigation/sidenav.scss +3 -12
  163. package/navigation/subnav.scss +20 -2
  164. package/navigation/tabnav.scss +9 -4
  165. package/navigation/underline-nav.scss +79 -28
  166. package/package.json +32 -26
  167. package/pagination/pagination.scss +65 -7
  168. package/popover/popover.scss +1 -2
  169. package/select-menu/select-menu.scss +3 -3
  170. package/stylelint.config.cjs +2 -11
  171. package/subhead/subhead.scss +3 -0
  172. package/support/mixins/color-modes.scss +3 -0
  173. package/support/mixins/misc.scss +48 -1
  174. package/support/mixins/typography.scss +3 -2
  175. package/support/variables/layout.scss +2 -3
  176. package/table-object/table-object.scss +3 -0
  177. package/timeline/timeline-item.scss +0 -1
  178. package/toasts/toasts.scss +7 -4
  179. package/tooltips/tooltips.scss +0 -7
  180. package/utilities/colors.scss +16 -0
  181. package/utilities/details.scss +81 -4
  182. package/utilities/layout.scss +1 -1
  183. package/utilities/margin.scss +4 -1
  184. package/utilities/padding.scss +3 -1
  185. package/utilities/visibility-display.scss +52 -3
  186. package/table-object/README.md +0 -25
@@ -1,8 +1,57 @@
1
+ // Stacked label (default)
2
+ .autocomplete-label-stacked {
3
+ display: block;
4
+ margin-bottom: $spacer-2 * 0.75;
5
+ }
6
+
7
+ // Inline label (non-default)
8
+ .autocomplete-label-inline {
9
+ display: inline;
10
+ margin-right: $spacer-2 * 0.75;
11
+ }
12
+
13
+ // Switch to stacked at smaller viewport
14
+ @media (max-width: $width-sm) {
15
+ .autocomplete-label-inline {
16
+ display: block;
17
+ margin-bottom: $spacer-2 * 0.75;
18
+ }
19
+ }
20
+
21
+ // Wrapper for the input and result elements to ensure alignment
22
+ .autocomplete-body {
23
+ position: relative;
24
+ display: inline;
25
+ }
26
+
27
+ // Wrapper and conditional styles for when an icon is added
28
+ .autocomplete-embedded-icon-wrap {
29
+ display: inline-flex;
30
+ padding: $spacer-1 $spacer-2;
31
+ align-items: center;
32
+
33
+ &:focus-within {
34
+ border-color: var(--color-accent-fg);
35
+
36
+ @include focusBoxShadowInset;
37
+ }
38
+
39
+ .form-control {
40
+ padding: 0;
41
+ margin-left: $spacer-2;
42
+ // stylelint-disable-next-line
43
+ border: none;
44
+ box-shadow: none;
45
+ }
46
+ }
47
+
1
48
  // A pop up list of items used to show autocompleted results
2
49
  .autocomplete-results {
3
50
  position: absolute;
51
+ left: 0;
4
52
  z-index: 99;
5
- width: 100%;
53
+ width: max-content;
54
+ min-width: 100%;
6
55
  max-height: 20em;
7
56
  overflow-y: auto;
8
57
  // stylelint-disable-next-line primer/typography
@@ -44,7 +93,7 @@
44
93
  }
45
94
 
46
95
  &.selected,
47
- &[aria-selected=true],
96
+ &[aria-selected='true'],
48
97
  &.navigation-focus {
49
98
  color: var(--color-fg-on-emphasis);
50
99
  text-decoration: none;
@@ -36,6 +36,7 @@
36
36
  border-right: $border-width $border-style var(--color-canvas-default);
37
37
  // stylelint-disable-next-line primer/borders
38
38
  border-radius: $border-radius-1;
39
+ box-shadow: none;
39
40
  transition: margin 0.1s ease-in-out;
40
41
 
41
42
  &:first-child {
package/base/base.scss CHANGED
@@ -1,4 +1,4 @@
1
- // stylelint-disable selector-max-type
1
+ // stylelint-disable selector-max-type, selector-no-qualifying-type
2
2
  * {
3
3
  box-sizing: border-box;
4
4
  }
@@ -46,6 +46,7 @@ hr,
46
46
  background: transparent;
47
47
  border: 0;
48
48
  border-bottom: $border-width $border-style var(--color-border-muted);
49
+
49
50
  @include clearfix();
50
51
  }
51
52
 
@@ -76,10 +77,70 @@ button {
76
77
  }
77
78
 
78
79
  details {
79
- summary { cursor: pointer; }
80
+ summary {
81
+ cursor: pointer;
82
+ }
80
83
 
81
84
  &:not([open]) {
82
85
  // Set details content hidden by default for browsers that don't do this
83
- > *:not(summary) { display: none !important; }
86
+ > *:not(summary) {
87
+ display: none !important;
88
+ }
89
+ }
90
+ }
91
+
92
+ // global focus styles
93
+
94
+ a,
95
+ button,
96
+ [role='button'],
97
+ input[type='radio'],
98
+ input[type='checkbox'] {
99
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
100
+ transition-property: color, background-color, box-shadow, border-color;
101
+ // fallback :focus state
102
+ &:focus {
103
+ @include focusOutline;
104
+
105
+ // remove fallback :focus if :focus-visible is supported
106
+ &:not(:focus-visible) {
107
+ outline: solid 1px transparent;
108
+ }
109
+ }
110
+
111
+ // default focus state
112
+ &:focus-visible {
113
+ @include focusOutline;
114
+ }
115
+ }
116
+
117
+ a:not([class]),
118
+ input[type='radio'],
119
+ input[type='checkbox'] {
120
+ &:focus,
121
+ &:focus-visible {
122
+ outline-offset: 0;
123
+ }
124
+ }
125
+
126
+ // for handling focus conditionally
127
+ .focus {
128
+ @include focusBoxShadowInset;
129
+ }
130
+
131
+ // Windows High Contrast mode
132
+ @media (forced-colors: active) {
133
+ *:focus,
134
+ *:focus-visible {
135
+ outline: solid 1px transparent;
136
+ }
137
+
138
+ input:not([type='radio'], [type='checkbox']),
139
+ textarea,
140
+ select {
141
+ &:focus,
142
+ &:focus-visible {
143
+ outline-offset: 2px;
144
+ }
84
145
  }
85
146
  }
package/base/index.scss CHANGED
@@ -1,5 +1,4 @@
1
1
  @import '../support/index.scss';
2
-
3
2
  @import './normalize.scss';
4
3
  @import './base.scss';
5
4
  @import './kbd.scss';
package/base/kbd.scss CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  kbd {
5
5
  display: inline-block;
6
- // stylelint-disable-next-line primer/spacing
7
6
  padding: ($spacer-1 - 1) ($spacer-1 + 1);
8
7
  font: 11px $mono-font;
9
8
  // stylelint-disable-next-line primer/typography
@@ -39,7 +39,8 @@ header,
39
39
  main, /* 2 */
40
40
  menu,
41
41
  nav,
42
- section { /* 1 */
42
+ section {
43
+ /* 1 */
43
44
  display: block;
44
45
  }
45
46
 
@@ -96,16 +97,6 @@ a {
96
97
  background-color: transparent; /* 1 */
97
98
  }
98
99
 
99
- /**
100
- * Remove the outline on focused links when they are also active or hovered
101
- * in all browsers (opinionated).
102
- */
103
-
104
- a:active,
105
- a:hover {
106
- outline-width: 0;
107
- }
108
-
109
100
  /* Text-level semantics
110
101
  ========================================================================== */
111
102
 
@@ -225,7 +216,7 @@ code,
225
216
  kbd,
226
217
  pre,
227
218
  samp {
228
- font-family: monospace, monospace; /* 1 */
219
+ font-family: monospace; /* 1 */
229
220
  font-size: 1em; /* 2 */
230
221
  }
231
222
 
@@ -278,7 +269,8 @@ optgroup {
278
269
  */
279
270
 
280
271
  button,
281
- input { /* 1 */
272
+ input {
273
+ /* 1 */
282
274
  overflow: visible;
283
275
  }
284
276
 
@@ -288,7 +280,8 @@ input { /* 1 */
288
280
  */
289
281
 
290
282
  button,
291
- select { /* 1 */
283
+ select {
284
+ /* 1 */
292
285
  text-transform: none;
293
286
  }
294
287
 
@@ -305,29 +298,6 @@ html [type="button"], /* 1 */
305
298
  -webkit-appearance: button; /* 2 */
306
299
  }
307
300
 
308
- /**
309
- * Remove the inner border and padding in Firefox.
310
- */
311
-
312
- button::-moz-focus-inner,
313
- [type="button"]::-moz-focus-inner,
314
- [type="reset"]::-moz-focus-inner,
315
- [type="submit"]::-moz-focus-inner {
316
- border-style: none;
317
- padding: 0;
318
- }
319
-
320
- /**
321
- * Restore the focus styles unset by the previous rule.
322
- */
323
-
324
- button:-moz-focusring,
325
- [type="button"]:-moz-focusring,
326
- [type="reset"]:-moz-focusring,
327
- [type="submit"]:-moz-focusring {
328
- outline: 1px dotted ButtonText;
329
- }
330
-
331
301
  /**
332
302
  * Change the border, margin, and padding in all browsers (opinionated).
333
303
  */
@@ -367,8 +337,8 @@ textarea {
367
337
  * 2. Remove the padding in IE 10-.
368
338
  */
369
339
 
370
- [type="checkbox"],
371
- [type="radio"] {
340
+ [type='checkbox'],
341
+ [type='radio'] {
372
342
  box-sizing: border-box; /* 1 */
373
343
  padding: 0; /* 2 */
374
344
  }
@@ -377,27 +347,17 @@ textarea {
377
347
  * Correct the cursor style of increment and decrement buttons in Chrome.
378
348
  */
379
349
 
380
- [type="number"]::-webkit-inner-spin-button,
381
- [type="number"]::-webkit-outer-spin-button {
350
+ [type='number']::-webkit-inner-spin-button,
351
+ [type='number']::-webkit-outer-spin-button {
382
352
  height: auto;
383
353
  }
384
354
 
385
- /**
386
- * 1. Correct the odd appearance in Chrome and Safari.
387
- * 2. Correct the outline style in Safari.
388
- */
389
-
390
- [type="search"] {
391
- -webkit-appearance: textfield; /* 1 */
392
- outline-offset: -2px; /* 2 */
393
- }
394
-
395
355
  /**
396
356
  * Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
397
357
  */
398
358
 
399
- [type="search"]::-webkit-search-cancel-button,
400
- [type="search"]::-webkit-search-decoration {
359
+ [type='search']::-webkit-search-cancel-button,
360
+ [type='search']::-webkit-search-decoration {
401
361
  -webkit-appearance: none;
402
362
  }
403
363
 
@@ -62,11 +62,12 @@ dd {
62
62
  margin-left: 0;
63
63
  }
64
64
 
65
- // Code
65
+ // Monospaced
66
66
  // --------------------------------------------------
67
67
 
68
68
  tt,
69
- code {
69
+ code,
70
+ samp {
70
71
  font-family: $mono-font;
71
72
  font-size: $font-size-small;
72
73
  }
@@ -30,12 +30,31 @@
30
30
  color: var(--color-fg-muted);
31
31
  }
32
32
 
33
+ .blankslate-image {
34
+ margin-bottom: $spacer-3;
35
+ }
36
+
37
+ .blankslate-heading {
38
+ margin-bottom: $spacer-1;
39
+ }
40
+
41
+ .blankslate-action {
42
+ margin-top: $spacer-3;
43
+
44
+ &:first-of-type {
45
+ margin-top: $spacer-4;
46
+ }
47
+
48
+ &:last-of-type {
49
+ margin-bottom: $spacer-2;
50
+ }
51
+ }
52
+
33
53
  .blankslate-capped {
34
54
  border-radius: 0 0 $border-radius $border-radius;
35
55
  }
36
56
 
37
57
  .blankslate-spacious {
38
- // stylelint-disable-next-line primer/spacing
39
58
  padding: ($spacer-6 * 2) $spacer-6;
40
59
  }
41
60
 
@@ -1,3 +1,2 @@
1
1
  @import '../support/index.scss';
2
-
3
2
  @import './blankslate.scss';
package/box/box.scss CHANGED
@@ -28,7 +28,6 @@
28
28
  .Box-btn-octicon {
29
29
  &.btn-octicon {
30
30
  padding: $spacer-2 $spacer-3;
31
- // stylelint-disable-next-line primer/spacing
32
31
  margin: (-$spacer-2) (-$spacer-3);
33
32
  line-height: $lh-condensed;
34
33
  }
@@ -60,7 +59,6 @@
60
59
  .Box-btn-octicon {
61
60
  &.btn-octicon {
62
61
  padding: $spacer-4;
63
- // stylelint-disable-next-line primer/spacing
64
62
  margin: (-$spacer-4) (-$spacer-4);
65
63
  }
66
64
  }
@@ -285,7 +283,6 @@
285
283
  // Increase specificity when btn-octicon is used because comes after .Box in the cascade
286
284
  &.btn-octicon {
287
285
  padding: $spacer-3 $spacer-3;
288
- // stylelint-disable-next-line primer/spacing
289
286
  margin: (-$spacer-3) (-$spacer-3);
290
287
  line-height: $lh-default; // override btn-octicon line-height
291
288
  }
@@ -8,6 +8,7 @@
8
8
  padding: 2px 6px;
9
9
  font: 12px $mono-font;
10
10
  color: var(--color-fg-muted);
11
+ word-break: break-all;
11
12
  background-color: var(--color-accent-subtle);
12
13
  border-radius: $border-radius;
13
14
 
@@ -21,7 +21,7 @@
21
21
  }
22
22
 
23
23
  .breadcrumb-item-selected,
24
- .breadcrumb-item[aria-current]:not([aria-current=false]) {
24
+ .breadcrumb-item[aria-current]:not([aria-current='false']) {
25
25
  &::after {
26
26
  content: none;
27
27
  }
@@ -6,6 +6,7 @@
6
6
  .BtnGroup {
7
7
  display: inline-block;
8
8
  vertical-align: middle;
9
+
9
10
  @include clearfix();
10
11
 
11
12
  // Proper spacing for multiple button groups (a la, gollum editor)
@@ -33,7 +34,7 @@
33
34
  }
34
35
 
35
36
  &.selected,
36
- &[aria-selected=true],
37
+ &[aria-selected='true'],
37
38
  &:focus,
38
39
  &:active,
39
40
  &:hover {
@@ -66,7 +67,7 @@
66
67
  }
67
68
 
68
69
  &.selected,
69
- &[aria-selected=true],
70
+ &[aria-selected='true'],
70
71
  &:focus,
71
72
  &:active,
72
73
  &:hover {
@@ -24,7 +24,7 @@
24
24
 
25
25
  &:disabled,
26
26
  &.disabled,
27
- &[aria-disabled=true] {
27
+ &[aria-disabled='true'] {
28
28
  cursor: default;
29
29
  }
30
30
 
@@ -66,8 +66,8 @@
66
66
  background-color: var(--color-btn-bg);
67
67
  border-color: var(--color-btn-border);
68
68
  box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);
69
- transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
70
- transition-property: color, background-color, border-color;
69
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
70
+ transition-property: color, background-color, box-shadow, border-color;
71
71
 
72
72
  &:hover,
73
73
  &.hover,
@@ -84,14 +84,14 @@
84
84
  }
85
85
 
86
86
  &.selected,
87
- &[aria-selected=true] {
87
+ &[aria-selected='true'] {
88
88
  background-color: var(--color-btn-selected-bg);
89
89
  box-shadow: var(--color-primer-shadow-inset);
90
90
  }
91
91
 
92
92
  &:disabled,
93
93
  &.disabled,
94
- &[aria-disabled=true] {
94
+ &[aria-disabled='true'] {
95
95
  color: var(--color-primer-fg-disabled);
96
96
  background-color: var(--color-btn-bg);
97
97
  border-color: var(--color-btn-border);
@@ -100,14 +100,6 @@
100
100
  color: var(--color-primer-fg-disabled);
101
101
  }
102
102
  }
103
-
104
- // Keep :focus after :disabled. Allows to see the focus ring even on disabled buttons
105
- &:focus,
106
- &.focus {
107
- border-color: var(--color-btn-focus-border);
108
- outline: none;
109
- box-shadow: var(--color-btn-focus-shadow);
110
- }
111
103
  }
112
104
 
113
105
  // Primary button
@@ -125,16 +117,32 @@
125
117
  border-color: var(--color-btn-primary-hover-border);
126
118
  }
127
119
 
120
+ // fallback :focus state
121
+ &:focus {
122
+ @include focusOutlineOnEmphasis;
123
+
124
+ // remove fallback :focus if :focus-visible is supported
125
+ &:not(:focus-visible) {
126
+ outline: solid 1px transparent;
127
+ box-shadow: none;
128
+ }
129
+ }
130
+
131
+ // default focus state
132
+ &:focus-visible {
133
+ @include focusOutlineOnEmphasis;
134
+ }
135
+
128
136
  &:active,
129
137
  &.selected,
130
- &[aria-selected=true] {
138
+ &[aria-selected='true'] {
131
139
  background-color: var(--color-btn-primary-selected-bg);
132
140
  box-shadow: var(--color-btn-primary-selected-shadow);
133
141
  }
134
142
 
135
143
  &:disabled,
136
144
  &.disabled,
137
- &[aria-disabled=true] {
145
+ &[aria-disabled='true'] {
138
146
  color: var(--color-btn-primary-disabled-text);
139
147
  background-color: var(--color-btn-primary-disabled-bg);
140
148
  border-color: var(--color-btn-primary-disabled-border);
@@ -144,13 +152,6 @@
144
152
  }
145
153
  }
146
154
 
147
- &:focus,
148
- &.focus {
149
- background-color: var(--color-btn-primary-focus-bg);
150
- border-color: var(--color-btn-primary-focus-border);
151
- box-shadow: var(--color-btn-primary-focus-shadow);
152
- }
153
-
154
155
  .Counter {
155
156
  color: inherit;
156
157
  background-color: var(--color-btn-primary-counter-bg);
@@ -161,6 +162,26 @@
161
162
  }
162
163
  }
163
164
 
165
+ // ensure links styled as button primary gets proper focus style
166
+ // stylelint-disable-next-line selector-no-qualifying-type
167
+ a.btn-primary {
168
+ // fallback :focus state
169
+ &:focus {
170
+ @include focusOutlineOnEmphasis;
171
+
172
+ // remove fallback :focus if :focus-visible is supported
173
+ &:not(:focus-visible) {
174
+ outline: solid 1px transparent;
175
+ box-shadow: none;
176
+ }
177
+ }
178
+
179
+ // default focus state
180
+ &:focus-visible {
181
+ @include focusOutlineOnEmphasis;
182
+ }
183
+ }
184
+
164
185
  // Outline button
165
186
 
166
187
  .btn-outline {
@@ -184,16 +205,32 @@
184
205
 
185
206
  &:active,
186
207
  &.selected,
187
- &[aria-selected=true] {
208
+ &[aria-selected='true'] {
188
209
  color: var(--color-btn-outline-selected-text);
189
210
  background-color: var(--color-btn-outline-selected-bg);
190
211
  border-color: var(--color-btn-outline-selected-border);
191
212
  box-shadow: var(--color-btn-outline-selected-shadow);
213
+
214
+ // fallback :focus state
215
+ &:focus {
216
+ @include focusOutlineOnEmphasis;
217
+
218
+ // remove fallback :focus if :focus-visible is supported
219
+ &:not(:focus-visible) {
220
+ outline: solid 1px transparent;
221
+ box-shadow: none;
222
+ }
223
+ }
224
+
225
+ // default focus state
226
+ &:focus-visible {
227
+ @include focusOutlineOnEmphasis;
228
+ }
192
229
  }
193
230
 
194
231
  &:disabled,
195
232
  &.disabled,
196
- &[aria-disabled=true] {
233
+ &[aria-disabled='true'] {
197
234
  color: var(--color-btn-outline-disabled-text);
198
235
  background-color: var(--color-btn-outline-disabled-bg);
199
236
  border-color: var(--color-btn-border);
@@ -204,11 +241,6 @@
204
241
  }
205
242
  }
206
243
 
207
- &:focus {
208
- border-color: var(--color-btn-outline-focus-border);
209
- box-shadow: var(--color-btn-outline-focus-shadow);
210
- }
211
-
212
244
  .Counter {
213
245
  color: inherit;
214
246
  background-color: var(--color-btn-outline-counter-bg);
@@ -242,7 +274,7 @@
242
274
 
243
275
  &:active,
244
276
  &.selected,
245
- &[aria-selected=true] {
277
+ &[aria-selected='true'] {
246
278
  color: var(--color-btn-danger-selected-text);
247
279
  background-color: var(--color-btn-danger-selected-bg);
248
280
  border-color: var(--color-btn-danger-selected-border);
@@ -251,7 +283,7 @@
251
283
 
252
284
  &:disabled,
253
285
  &.disabled,
254
- &[aria-disabled=true] {
286
+ &[aria-disabled='true'] {
255
287
  color: var(--color-btn-danger-disabled-text);
256
288
  background-color: var(--color-btn-danger-disabled-bg);
257
289
  border-color: var(--color-btn-border);
@@ -266,11 +298,6 @@
266
298
  }
267
299
  }
268
300
 
269
- &:focus {
270
- border-color: var(--color-btn-danger-focus-border);
271
- box-shadow: var(--color-btn-danger-focus-shadow);
272
- }
273
-
274
301
  .Counter {
275
302
  color: inherit;
276
303
  background-color: var(--color-btn-danger-counter-bg);
@@ -294,6 +321,7 @@
294
321
 
295
322
  // Large button adds more padding around text. Use font-size utils to increase font-size.. e.g, <p class="text-gamma"><button class="btn btn-large btn-primary" type="button">Big green button</button></p>
296
323
  .btn-large {
324
+ // stylelint-disable-next-line primer/spacing
297
325
  padding: $em-spacer-6 1.5em;
298
326
  font-size: inherit;
299
327
  line-height: $lh-default;