@kungal/ui-tokens 2.40.3 → 2.42.0
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.
- package/CHANGELOG.md +21 -0
- package/package.json +1 -1
- package/src/base.css +39 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @kungal/ui-tokens
|
|
2
2
|
|
|
3
|
+
## 2.42.0
|
|
4
|
+
|
|
5
|
+
## 2.41.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- 450db2e: **Keyboard focus is visible again.** `@kungal/ui-tokens/base.css` removed every outline with `*:focus { outline: none }` and drew nothing in its place. Tabbing through a KunUI app therefore showed no focus on many controls: the links in KunAvatar, KunUserChip, KunLink, KunBrand and a linked KunCard, and the buttons of KunTab, KunAccordion, KunRating, KunReaction and KunCarousel, among others. In Chrome 153, 26 of the docs site's component pages had at least one such control. The base layer now draws a ring on `:focus-visible`: 2px, primary at 50%, 2px outside the element. Keyboard focus shows it; a mouse click does not.
|
|
10
|
+
|
|
11
|
+
What this changes for you if you import `base.css`:
|
|
12
|
+
|
|
13
|
+
- **Your own elements get the ring too.** Buttons, links and `tabindex` elements show it when focused from the keyboard. If an element already draws its own focus style, add `outline-none` to it, as KunUI's own controls do; that utility wins over the base layer.
|
|
14
|
+
- **Text fields are unchanged.** `input`, `textarea` and `[contenteditable]` keep the old reset, because they match `:focus-visible` on a click as well. KunUI's fields draw their ring on the wrapper instead.
|
|
15
|
+
- **Interactive elements carry the ring's colour, width and offset while unfocused**, with no outline style, so that focusing changes only the style. Without this, an element with a `transition` class animated into the ring from a black 3px outline. The side effect: a bare `outline` utility with no colour on a button or link now draws in the ring's colour. Add a colour utility if you want `currentColor` back.
|
|
16
|
+
|
|
17
|
+
Four components needed fixes of their own:
|
|
18
|
+
|
|
19
|
+
- **KunSwitch:** its focus ring never appeared. The `peer-focus-visible` classes were on an element that is not a sibling of the input, which `peer-*` requires.
|
|
20
|
+
- **KunRating and the remove button in KunTagInput:** both set `focus:outline-none` without drawing a ring of their own.
|
|
21
|
+
- **KunTabPanel:** same as above. It is a tab stop while it is the active panel.
|
|
22
|
+
- **KunTab:** the ring now sits inside the tab, in the tab's own text colour at 50%. Drawn outside, it was clipped by the scrolling tab strip on the underlined and pills variants. Drawn in primary, it disappeared on a selected primary solid or pills tab.
|
|
23
|
+
|
|
3
24
|
## 2.40.3
|
|
4
25
|
|
|
5
26
|
## 2.40.2
|
package/package.json
CHANGED
package/src/base.css
CHANGED
|
@@ -27,7 +27,45 @@
|
|
|
27
27
|
color: inherit;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/* Keyboard focus draws a ring; a click does not. This rule used to be
|
|
31
|
+
* `*:focus { outline: none }` with nothing drawn in its place, and tabbing
|
|
32
|
+
* through the docs site in Chrome 153 showed no focus at all on 26 component
|
|
33
|
+
* pages: the links in KunAvatar, KunUserChip, KunLink, KunBrand and KunCard,
|
|
34
|
+
* and the buttons of KunTab, KunAccordion, KunReaction and KunCarousel,
|
|
35
|
+
* among others. A component that draws its own ring sets `outline-none`,
|
|
36
|
+
* which wins from the utilities layer. */
|
|
37
|
+
:focus-visible {
|
|
38
|
+
outline: 2px solid oklch(var(--primary-accent) / 0.5);
|
|
39
|
+
outline-offset: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* The same colour, width and offset before focus, so focusing flips only the
|
|
43
|
+
* style. From the initial `currentColor`, `medium` and `0`, an element with a
|
|
44
|
+
* `transition` class tweened into the ring from a 3px black outline: KunCard
|
|
45
|
+
* and KunAvatar, for about 80ms. */
|
|
46
|
+
:where(a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]) {
|
|
47
|
+
outline-color: oklch(var(--primary-accent) / 0.5);
|
|
48
|
+
outline-width: 2px;
|
|
49
|
+
outline-offset: 2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* A text field matches :focus-visible on a click too. KunUI's fields ring
|
|
53
|
+
* their wrapper instead, and an app's own fields keep the old reset. */
|
|
54
|
+
:where(
|
|
55
|
+
input:not(
|
|
56
|
+
[type='checkbox'],
|
|
57
|
+
[type='radio'],
|
|
58
|
+
[type='range'],
|
|
59
|
+
[type='button'],
|
|
60
|
+
[type='submit'],
|
|
61
|
+
[type='reset'],
|
|
62
|
+
[type='file'],
|
|
63
|
+
[type='color'],
|
|
64
|
+
[type='image']
|
|
65
|
+
),
|
|
66
|
+
textarea,
|
|
67
|
+
[contenteditable]
|
|
68
|
+
):focus {
|
|
31
69
|
outline: none;
|
|
32
70
|
}
|
|
33
71
|
|