@primer/css 19.8.2 → 20.0.0-rc.04a33ecf

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 (113) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/DEVELOP.md +26 -21
  3. package/actionlist/action-list-item.scss +10 -7
  4. package/autocomplete/autocomplete.scss +7 -3
  5. package/base/base.scss +63 -3
  6. package/base/normalize.scss +12 -52
  7. package/box/box-overlay.scss +2 -0
  8. package/buttons/button.scss +54 -27
  9. package/buttons/misc.scss +25 -19
  10. package/dist/actionlist.css +1 -1
  11. package/dist/actionlist.css.map +1 -1
  12. package/dist/alerts.css +1 -1
  13. package/dist/alerts.css.map +1 -1
  14. package/dist/autocomplete.css +1 -1
  15. package/dist/autocomplete.css.map +1 -1
  16. package/dist/avatars.css.map +1 -1
  17. package/dist/base.css +1 -1
  18. package/dist/base.css.map +1 -1
  19. package/dist/blankslate.css.map +1 -1
  20. package/dist/box.css.map +1 -1
  21. package/dist/branch-name.css.map +1 -1
  22. package/dist/breadcrumb.css.map +1 -1
  23. package/dist/buttons.css +1 -1
  24. package/dist/buttons.css.map +1 -1
  25. package/dist/color-modes.css.map +1 -1
  26. package/dist/core.css +1 -1
  27. package/dist/core.css.map +1 -1
  28. package/dist/dropdown.css +1 -1
  29. package/dist/dropdown.css.map +1 -1
  30. package/dist/forms.css +1 -1
  31. package/dist/forms.css.map +1 -1
  32. package/dist/header.css.map +1 -1
  33. package/dist/labels.css.map +1 -1
  34. package/dist/layout.css.map +1 -1
  35. package/dist/links.css +1 -1
  36. package/dist/links.css.map +1 -1
  37. package/dist/loaders.css.map +1 -1
  38. package/dist/markdown.css.map +1 -1
  39. package/dist/marketing-buttons.css +1 -1
  40. package/dist/marketing-buttons.css.map +1 -1
  41. package/dist/marketing-links.css +1 -1
  42. package/dist/marketing-links.css.map +1 -1
  43. package/dist/marketing-type.css +1 -1
  44. package/dist/marketing-type.css.map +1 -1
  45. package/dist/marketing-utilities.css.map +1 -1
  46. package/dist/marketing.css +1 -1
  47. package/dist/marketing.css.map +1 -1
  48. package/dist/meta.json +77 -77
  49. package/dist/navigation.css +1 -1
  50. package/dist/navigation.css.map +1 -1
  51. package/dist/pagination.css +1 -1
  52. package/dist/pagination.css.map +1 -1
  53. package/dist/popover.css.map +1 -1
  54. package/dist/primer.css +3 -3
  55. package/dist/primer.css.map +1 -1
  56. package/dist/product.css +1 -1
  57. package/dist/product.css.map +1 -1
  58. package/dist/progress.css.map +1 -1
  59. package/dist/select-menu.css.map +1 -1
  60. package/dist/stats/actionlist.json +1 -1
  61. package/dist/stats/alerts.json +1 -1
  62. package/dist/stats/autocomplete.json +1 -1
  63. package/dist/stats/base.json +1 -1
  64. package/dist/stats/buttons.json +1 -1
  65. package/dist/stats/core.json +1 -1
  66. package/dist/stats/dropdown.json +1 -1
  67. package/dist/stats/forms.json +1 -1
  68. package/dist/stats/links.json +1 -1
  69. package/dist/stats/marketing-buttons.json +1 -1
  70. package/dist/stats/marketing-links.json +1 -1
  71. package/dist/stats/marketing-type.json +1 -1
  72. package/dist/stats/marketing.json +1 -1
  73. package/dist/stats/navigation.json +1 -1
  74. package/dist/stats/pagination.json +1 -1
  75. package/dist/stats/primer.json +1 -1
  76. package/dist/stats/product.json +1 -1
  77. package/dist/stats/toasts.json +1 -1
  78. package/dist/stats/utilities.json +1 -1
  79. package/dist/subhead.css.map +1 -1
  80. package/dist/timeline.css.map +1 -1
  81. package/dist/toasts.css +1 -1
  82. package/dist/toasts.css.map +1 -1
  83. package/dist/tooltips.css.map +1 -1
  84. package/dist/truncate.css.map +1 -1
  85. package/dist/utilities.css +1 -1
  86. package/dist/utilities.css.map +1 -1
  87. package/dist/variables.json +27 -27
  88. package/dropdown/dropdown.scss +0 -2
  89. package/forms/form-control.scss +23 -5
  90. package/forms/form-group.scss +39 -13
  91. package/forms/form-validation.scss +11 -6
  92. package/forms/input-group.scss +8 -0
  93. package/links/link.scss +5 -0
  94. package/marketing/buttons/button.scss +32 -26
  95. package/marketing/links/link.scss +5 -5
  96. package/marketing/type/typography.scss +18 -29
  97. package/marketing/utilities/layout.scss +1 -1
  98. package/navigation/filter-list.scss +18 -0
  99. package/navigation/menu.scss +6 -8
  100. package/navigation/sidenav.scss +1 -10
  101. package/navigation/subnav.scss +19 -0
  102. package/navigation/tabnav.scss +7 -2
  103. package/navigation/underline-nav.scss +73 -23
  104. package/package.json +18 -16
  105. package/pagination/pagination.scss +24 -3
  106. package/popover/popover.scss +1 -0
  107. package/support/mixins/color-modes.scss +2 -0
  108. package/support/mixins/layout.scss +1 -0
  109. package/support/mixins/misc.scss +47 -1
  110. package/support/variables/layout.scss +1 -0
  111. package/timeline/timeline-item.scss +2 -0
  112. package/toasts/toasts.scss +7 -4
  113. package/utilities/details.scss +81 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @primer/css
2
2
 
3
+ ## 20.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#1744](https://github.com/primer/css/pull/1744) [`942f65a4`](https://github.com/primer/css/commit/942f65a45a18b7042ba1ce2703688b62d874cf18) Thanks [@langermank](https://github.com/langermank)! - Global CSS focus styles
8
+
9
+ * [#1767](https://github.com/primer/css/pull/1767) [`7e01db97`](https://github.com/primer/css/commit/7e01db97f3f2b9d9383f66385ca16f0bdc06abd1) Thanks [@tobiasahlin](https://github.com/tobiasahlin)! - Marketing: Remove unused pullquote selector
10
+
11
+ - [#1821](https://github.com/primer/css/pull/1821) [`daa2685c`](https://github.com/primer/css/commit/daa2685c596d894b3bae1896bf97c3319cd9816c) Thanks [@jonrohan](https://github.com/jonrohan)! - UnderlineNav `:focus` styles
12
+ Refactor selected state and spacing
13
+ Add selected bold state override from github/github
14
+
15
+ * [#2047](https://github.com/primer/css/pull/2047) [`553d72cc`](https://github.com/primer/css/commit/553d72cc1baaf43a4c743c50cc8881f3811123e9) Thanks [@langermank](https://github.com/langermank)! - UnderlineNav bug fix
16
+
17
+ - [#2046](https://github.com/primer/css/pull/2046) [`55e2b069`](https://github.com/primer/css/commit/55e2b069a4cbd225af676bef918bbbe2e6cd73b7) Thanks [@langermank](https://github.com/langermank)! - Global focus style CSS from feature flag (next major)
18
+
19
+ ### Patch Changes
20
+
21
+ - [#2041](https://github.com/primer/css/pull/2041) [`20550bbf`](https://github.com/primer/css/commit/20550bbfaa236ac197ca58805542eaab0bf38fd4) Thanks [@jonrohan](https://github.com/jonrohan)! - Upgrading to stylelint-config-12.4.0
22
+
3
23
  ## 19.8.2
4
24
 
5
25
  ### Patch Changes
package/DEVELOP.md CHANGED
@@ -3,29 +3,32 @@
3
3
  If you've made it this far, **thank you**! We appreciate your contribution, and hope that this document helps you along the way. If you have any questions or problems, don't hesitate to [file an issue](https://github.com/primer/css/issues/new).
4
4
 
5
5
  ## Structure
6
+
6
7
  Primer CSS is published to [npm] as [@primer/css]. Each of Primer CSS's "modules" lives in a subfolder under `src/` with an `index.scss` in it. Generally speaking, the styles are divided into three primary themes:
7
8
 
8
- * **Core** styles (in `core/`) are common dependencies, which include support variables, native element and typography styles, buttons, navigation, tooltips, etc.
9
- * **Product** styles (in `product/`) are specific to github.com, and include components such as avatars, labels, markdown styles, popovers, and progress indicators.
10
- * **Marketing** styles (in `marketing/`) are specific to GitHub marketing efforts, including international and event-focused sites as well as the more design-heavy feature pages on github.com. Marketing styles include new colors and button styles, and extend the core typography and whitespace scales.
9
+ - **Core** styles (in `core/`) are common dependencies, which include support variables, native element and typography styles, buttons, navigation, tooltips, etc.
10
+ - **Product** styles (in `product/`) are specific to github.com, and include components such as avatars, labels, markdown styles, popovers, and progress indicators.
11
+ - **Marketing** styles (in `marketing/`) are specific to GitHub marketing efforts, including international and event-focused sites as well as the more design-heavy feature pages on github.com. Marketing styles include new colors and button styles, and extend the core typography and whitespace scales.
11
12
 
12
13
  ### Paths
13
- Here's what you need to know about how the files are structured in both git and in the published npm module:
14
14
 
15
- * In git, all of the SCSS source files live in the `src/` directory.
16
- * When published, all of the files in `src/` are "hoisted" to the package root so that you can import, say, utilities with:
15
+ Here's what you need to know about how the files are structured in both git and in the published npm module:
17
16
 
18
- ```scss
19
- @import "@primer/css/utilities/index.scss";
20
- ```
17
+ - In git, all of the SCSS source files live in the `src/` directory.
18
+ - When published, all of the files in `src/` are "hoisted" to the package root so that you can import, say, utilities with:
21
19
 
22
- * All bundle interdependencies within Primer CSS are defined as relative imports (e.g. with `../`), so everything should work fine as long as the `@primer/css` directory is in one of your Sass include paths (i.e. `node_modules`).
20
+ ```scss
21
+ @import '@primer/css/utilities/index.scss';
22
+ ```
23
23
 
24
+ - All bundle interdependencies within Primer CSS are defined as relative imports (e.g. with `../`), so everything should work fine as long as the `@primer/css` directory is in one of your Sass include paths (i.e. `node_modules`).
24
25
 
25
26
  ## Install
27
+
26
28
  Run `npm install` to install the npm dependencies.
27
29
 
28
30
  ## Docs site
31
+
29
32
  The Primer CSS docs are built with React using [Doctocat](https://primer.style/doctocat) and automatically deployed on every push to this repo with [Now]. You can run the server locally with:
30
33
 
31
34
  ```sh
@@ -35,41 +38,43 @@ npm start
35
38
  Then visit http://localhost:8000 to view the site.
36
39
 
37
40
  ### The docs directory
38
- The [docs directory](../docs/) contains all of the documentation files in our docs site. Files are nested in the `/content` folder.
39
41
 
42
+ The [docs directory](../docs/) contains all of the documentation files in our docs site. Files are nested in the `/content` folder.
40
43
 
41
44
  ### Code blocks
45
+
42
46
  All `html` fenced code blocks in `src/**/*.md` will be rendered as stories and listed under the relevant module's name in the left-hand nav. File changes should trigger a live reload automatically (after a brief delay).
43
47
 
44
48
  ## Storybook
45
49
 
46
- Primer CSS Storybook is used for designing and prototyping components. Stories are written in HTML and leverage the Storybook API for configuring conditional logic.
50
+ Primer CSS Storybook is used for designing and prototyping components. Stories are written in HTML and leverage the Storybook API for configuring conditional logic.
47
51
 
48
52
  ```sh
49
53
  npm run storybook
50
54
  ```
51
55
 
52
56
  ### The Storybook directory
57
+
53
58
  Storybook configuration files live in [.storybook](../docs/.storybook). Addons and additional global config can be added to [main.js](../docs/.storybook/main.js) or [preview.js](../docs/.storybook/preview.js)
54
59
 
55
60
  ### Stories
61
+
56
62
  Stories are individual `.jsx` or `.mdx` files that contain component HTML for prototyping, typically showcasing all possible variations of a component. Stories can be found in the [stories directory](../docs/src/stories/components) and are organized by component. Storybook will build and deploy a preview on any open Pull Request.
57
63
 
58
64
  ## Scripts
65
+
59
66
  Our [`package.json`](package.json) houses a collection of [run-scripts] that we use to maintain, test, build, and publish Primer CSS. Run `npm run <script>` with any of the following values for `<script>`:
60
67
 
61
- * `dist` runs `script/dist`, which creates CSS bundles of all the `index.scss` files in `src/`.
62
- * `check-links` runs a link checker on your local development server (`localhost:3000`, started with `npm start`).
63
- * `stylelint` lints the CSS source files.
64
- * `eslint` lints the JavaScript source files.
65
- * `now-build` and `now-start` are run on [Now] to build and start the docs site server. `now-test` runs them both in order.
66
- * `start` runs the documentation site locally (alias: `dev`).
67
- * `test` runs our test suite.
68
- * `storybook` runs storybook local development server.
68
+ - `dist` runs `script/dist`, which creates CSS bundles of all the `index.scss` files in `src/`.
69
+ - `check-links` runs a link checker on your local development server (`localhost:3000`, started with `npm start`).
70
+ - `stylelint` lints the CSS source files.
71
+ - `eslint` lints the JavaScript source files.
72
+ - `start` runs the documentation site locally (alias: `dev`).
73
+ - `test` runs our test suite.
74
+ - `storybook` runs storybook local development server.
69
75
 
70
76
  The above list may not always be up-to-date. You can list all of the available scripts by calling `npm run` with no other arguments.
71
77
 
72
-
73
78
  [@primer/css]: https://www.npmjs.com/package/@primer/css
74
79
  [run-scripts]: https://docs.npmjs.com/cli/run-script
75
80
  [now]: https://zeit.co/now
@@ -1,12 +1,5 @@
1
1
  // stylelint-disable max-nesting-depth, selector-max-specificity, selector-max-compound-selectors
2
2
 
3
- @mixin focusOutline {
4
- position: relative;
5
- z-index: 1;
6
- outline: none;
7
- box-shadow: 0 0 0 2px var(--color-accent-fg); // this color breaks convention
8
- }
9
-
10
3
  @mixin activeIndicatorLine {
11
4
  position: absolute;
12
5
  top: calc(50% - 12px);
@@ -314,6 +307,16 @@
314
307
  text-decoration: none;
315
308
  }
316
309
 
310
+ &:focus {
311
+ @include focusOutline;
312
+
313
+ // remove fallback :focus if :focus-visible is supported
314
+ &:not(:focus-visible) {
315
+ outline: solid 1px transparent;
316
+ }
317
+ }
318
+
319
+ // default focus state
317
320
  &:focus-visible {
318
321
  @include focusOutline;
319
322
  }
@@ -31,9 +31,9 @@
31
31
  align-items: center;
32
32
 
33
33
  &:focus-within {
34
- border-color: var(--color-accent-emphasis);
35
- outline: none;
36
- box-shadow: var(--color-primer-shadow-focus);
34
+ border-color: var(--color-accent-fg);
35
+
36
+ @include focusBoxShadowInset;
37
37
  }
38
38
 
39
39
  .form-control {
@@ -46,6 +46,10 @@
46
46
  &:focus {
47
47
  box-shadow: none;
48
48
  }
49
+
50
+ &:focus-visible {
51
+ box-shadow: none;
52
+ }
49
53
  }
50
54
  }
51
55
 
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
  }
@@ -77,10 +77,70 @@ button {
77
77
  }
78
78
 
79
79
  details {
80
- summary { cursor: pointer; }
80
+ summary {
81
+ cursor: pointer;
82
+ }
81
83
 
82
84
  &:not([open]) {
83
85
  // Set details content hidden by default for browsers that don't do this
84
- > *: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
+ }
85
145
  }
86
146
  }
@@ -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
 
@@ -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
 
@@ -1,4 +1,5 @@
1
1
  .Box--overlay {
2
+ // stylelint-disable-next-line primer/responsive-widths
2
3
  width: 448px;
3
4
  margin-right: auto;
4
5
  margin-left: auto;
@@ -22,6 +23,7 @@
22
23
  }
23
24
 
24
25
  .Box-overlay--wide {
26
+ // stylelint-disable-next-line primer/responsive-widths
25
27
  width: 640px;
26
28
  }
27
29
 
@@ -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,
@@ -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,6 +117,22 @@
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
138
  &[aria-selected='true'] {
@@ -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 {
@@ -189,6 +210,22 @@
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,
@@ -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);
@@ -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);
package/buttons/misc.scss CHANGED
@@ -28,6 +28,14 @@
28
28
  cursor: default;
29
29
  }
30
30
  }
31
+
32
+ &:not(.dropdown-item) {
33
+ &:focus,
34
+ &:focus-visible {
35
+ border-radius: $border-radius;
36
+ outline-offset: 0;
37
+ }
38
+ }
31
39
  }
32
40
 
33
41
  // Invisible button
@@ -37,6 +45,7 @@
37
45
  color: var(--color-accent-fg);
38
46
  background-color: transparent; // Reset default gradient backgrounds and colors
39
47
  border: 0;
48
+ border-radius: $border-radius;
40
49
  box-shadow: none;
41
50
 
42
51
  &:hover,
@@ -48,15 +57,14 @@
48
57
  }
49
58
 
50
59
  &:active,
51
- &:focus,
52
60
  &.selected,
53
61
  &[aria-selected='true'],
54
62
  &.zeroclipboard-is-active {
55
63
  color: var(--color-accent-fg);
56
- background-color: none;
64
+ background: none;
57
65
  border-color: var(--color-btn-active-border);
58
- outline: none;
59
- box-shadow: var(--color-btn-focus-shadow);
66
+
67
+ @include focusOutline;
60
68
  }
61
69
 
62
70
  &:active &.zeroclipboard-is-active {
@@ -89,14 +97,23 @@
89
97
  border: 0;
90
98
  box-shadow: none;
91
99
 
92
- &:hover { color: var(--color-accent-fg); }
100
+ &:hover {
101
+ color: var(--color-accent-fg);
102
+ }
103
+
104
+ &:focus,
105
+ &:focus-visible {
106
+ border-radius: $border-radius;
107
+ }
93
108
 
94
109
  &.disabled,
95
110
  &[aria-disabled='true'] {
96
111
  color: var(--color-primer-fg-disabled);
97
112
  cursor: default;
98
113
 
99
- &:hover { color: var(--color-primer-fg-disabled); }
114
+ &:hover {
115
+ color: var(--color-primer-fg-disabled);
116
+ }
100
117
  }
101
118
  }
102
119
 
@@ -112,18 +129,13 @@
112
129
  color: var(--color-fg-muted);
113
130
  background: transparent;
114
131
  border: 0;
115
- outline: none;
116
132
 
117
133
  &:hover {
118
134
  color: var(--color-fg-default);
119
135
  }
120
136
 
121
- &:active,
122
- &:focus {
123
- color: var(--color-fg-muted);
124
- border-color: var(--color-btn-active-border);
125
- outline: none;
126
- box-shadow: var(--color-btn-focus-shadow);
137
+ &:active {
138
+ @include focusOutline;
127
139
  }
128
140
  }
129
141
 
@@ -216,10 +228,4 @@
216
228
  color: var(--color-accent-fg);
217
229
  cursor: pointer;
218
230
  }
219
-
220
- &:focus {
221
- z-index: 1;
222
- outline: 0;
223
- box-shadow: var(--color-primer-shadow-focus);
224
- }
225
231
  }