actual-css 0.19.4 → 0.20.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 +67 -0
- package/README.md +6 -6
- package/components.json +6 -3
- package/dist/actual.full.css +249 -50
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/dist/types/menu.d.ts +2 -5
- package/docs/pages/components/accordion.md +11 -6
- package/docs/pages/components/alert.md +64 -62
- package/docs/pages/components/avatar.md +12 -12
- package/docs/pages/components/badge.md +15 -15
- package/docs/pages/components/breadcrumb.md +10 -8
- package/docs/pages/components/button.md +56 -7
- package/docs/pages/components/card.md +21 -21
- package/docs/pages/components/dialog.md +97 -69
- package/docs/pages/components/drawer.md +33 -33
- package/docs/pages/components/indicator.md +12 -12
- package/docs/pages/components/navbar.md +41 -9
- package/docs/pages/components/pagination.md +7 -7
- package/docs/pages/components/progress.md +18 -13
- package/docs/pages/components/rating.md +19 -19
- package/docs/pages/components/reveal.md +2 -0
- package/docs/pages/components/segmented.md +35 -31
- package/docs/pages/components/skeleton.md +10 -8
- package/docs/pages/components/spinner.md +21 -15
- package/docs/pages/components/table.md +26 -28
- package/docs/pages/enhancements/flyout.md +94 -43
- package/docs/pages/enhancements/in-view.md +3 -1
- package/docs/pages/enhancements/scrollspy.md +51 -18
- package/docs/pages/enhancements/tabs.md +43 -37
- package/docs/pages/enhancements/tooltip.md +4 -2
- package/docs/pages/forms/ajax.md +66 -0
- package/docs/pages/forms/choice-cards.md +8 -8
- package/docs/pages/forms/color-swatches.md +12 -12
- package/docs/pages/forms/form-actions.md +23 -0
- package/docs/pages/forms/joined-controls.md +8 -8
- package/docs/pages/forms/labels.md +11 -11
- package/docs/pages/forms/overview.md +35 -29
- package/docs/pages/forms/states-and-sizes.md +9 -9
- package/docs/pages/forms/switch.md +35 -2
- package/docs/pages/forms/validation.md +16 -16
- package/docs/pages/foundations/theming.md +32 -2
- package/docs/pages/foundations/tokens.md +18 -16
- package/docs/pages/guides/coding-agents.md +18 -0
- package/docs/pages/guides/introduction.md +1 -1
- package/llms.txt +3 -3
- package/package.json +5 -5
- package/reserved-classes.json +1 -0
- package/skills/actual-css/SKILL.md +7 -0
- package/src/cli/actual-css.js +3 -3
- package/src/css/components/badge.css +10 -6
- package/src/css/components/button.css +20 -7
- package/src/css/components/join.css +14 -4
- package/src/css/components/navbar.css +83 -1
- package/src/css/components/pagination.css +3 -1
- package/src/css/components/segmented.css +27 -7
- package/src/css/core/theme.css +11 -9
- package/src/css/core/tokens.css +7 -1
- package/src/css/core/variants.css +2 -0
- package/src/css/effects/reveal.css +15 -6
- package/src/css/forms/control.css +11 -1
- package/src/css/forms/form.css +14 -4
- package/src/css/forms/switch.css +32 -3
- package/src/js/ajax.js +18 -1
- package/src/js/context-menu.js +1 -3
- package/src/js/flyout.js +14 -5
- package/src/js/in-view.js +41 -30
- package/src/js/menu.js +9 -21
- package/src/js/surface.js +38 -0
- package/src/tooling/design-tokens.js +1 -0
- package/src/tooling/theme-contrast.js +24 -9
- package/tokens.json +1 -0
- package/docs/design-notes/accessibility-decisions.md +0 -63
- package/docs/design-notes/app-ui.md +0 -67
- package/docs/design-notes/architecture.md +0 -70
- package/docs/design-notes/browser-support.md +0 -239
- package/docs/design-notes/cascade-layer.md +0 -74
- package/docs/design-notes/column-layout.md +0 -260
- package/docs/design-notes/css-anchor.md +0 -87
- package/docs/design-notes/enhancement-contract.md +0 -193
- package/docs/design-notes/forced-colors.md +0 -123
- package/docs/design-notes/grid.md +0 -785
- package/docs/design-notes/motion-cost.md +0 -62
- package/docs/design-notes/naming.md +0 -71
- package/docs/design-notes/platform-alignment.md +0 -602
- package/docs/design-notes/popover-manual-poc.md +0 -328
- package/docs/design-notes/references.md +0 -336
- package/docs/design-notes/rich-text.md +0 -61
- package/docs/design-notes/spacing-units.md +0 -286
- package/docs/design-notes/steps.md +0 -776
- package/docs/design-notes/surface-reparenting.md +0 -130
- package/docs/design-notes/tokens.md +0 -166
- package/docs/design-notes/tooltip-coordinate-space.md +0 -130
- package/docs/design-notes/widget-primitives.md +0 -144
- package/docs/navigation.json +0 -176
package/src/js/flyout.js
CHANGED
|
@@ -6,6 +6,10 @@ import { connectMenu, focusFirstMenuItem, focusLastMenuItem } from "./menu.js";
|
|
|
6
6
|
import { closeSurface, isSurfaceOpen, openSurface, retainSurface } from "./surface.js";
|
|
7
7
|
|
|
8
8
|
const triggerMap = new WeakMap();
|
|
9
|
+
// Which trigger opened each panel. Only that one sends Tab into the panel: a
|
|
10
|
+
// second trigger after the panel would otherwise send focus back in forever
|
|
11
|
+
// (link, second trigger, link…), since the panel's last stop leads to it.
|
|
12
|
+
const openers = new WeakMap();
|
|
9
13
|
|
|
10
14
|
function readFlyoutOptions(panel) {
|
|
11
15
|
const opts = { autoClose: "true" };
|
|
@@ -37,11 +41,13 @@ function isAriaMenu(panel) {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
function openFlyout(panel, trigger) {
|
|
40
|
-
|
|
44
|
+
const opened = openSurface(panel, {
|
|
41
45
|
trigger,
|
|
42
46
|
source: trigger,
|
|
43
47
|
...readFlyoutOptions(panel),
|
|
44
48
|
});
|
|
49
|
+
if (opened) openers.set(panel, trigger);
|
|
50
|
+
return opened;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
function openAndFocusPanel(flyout, trigger) {
|
|
@@ -87,7 +93,12 @@ function onTriggerKeydown(e) {
|
|
|
87
93
|
else openAndFocusPanel(panel, trigger);
|
|
88
94
|
break;
|
|
89
95
|
case "Tab":
|
|
90
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
isSurfaceOpen(panel) &&
|
|
98
|
+
openers.get(panel) === trigger &&
|
|
99
|
+
!e.shiftKey &&
|
|
100
|
+
focusFirstDescendant(panel)
|
|
101
|
+
) {
|
|
91
102
|
e.preventDefault();
|
|
92
103
|
}
|
|
93
104
|
break;
|
|
@@ -160,9 +171,7 @@ function resolvePanel(trigger, state) {
|
|
|
160
171
|
state.panel = panel;
|
|
161
172
|
|
|
162
173
|
if (isMenuFlyout(panel)) {
|
|
163
|
-
state.releaseMenu = connectMenu(panel
|
|
164
|
-
close: (menu) => closeSurface(menu),
|
|
165
|
-
});
|
|
174
|
+
state.releaseMenu = connectMenu(panel);
|
|
166
175
|
}
|
|
167
176
|
if (!trigger.hasAttribute("aria-haspopup") && isAriaMenu(panel)) {
|
|
168
177
|
trigger.setAttribute("aria-haspopup", "menu");
|
package/src/js/in-view.js
CHANGED
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
*
|
|
18
18
|
* A pending element keeps its text in the accessibility tree and in the tab
|
|
19
19
|
* order; effects hide it with opacity alone. `focusin` releases it at once and
|
|
20
|
-
* finishes
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* finishes its entrance, also when the element was already released and the
|
|
21
|
+
* entrance is still running or waiting out a delay, so keyboard focus never
|
|
22
|
+
* lands on invisible or fading content. In-page find still matches the text,
|
|
23
|
+
* because nothing is removed from the layer.
|
|
23
24
|
*
|
|
24
25
|
* One initial IntersectionObserver per document protects content already in
|
|
25
26
|
* view. Optional data-in-view-margin values share additional observers for
|
|
@@ -82,31 +83,42 @@ function triggerFor(connection, margin) {
|
|
|
82
83
|
return observer;
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
// Releasing the state also records the entrance it leaves running, so focus
|
|
87
|
+
// can finish it later. The entrance is what the release started, found by
|
|
88
|
+
// difference, plus what already runs on the element and its direct children:
|
|
89
|
+
// an element visible at load never goes pending and plays its first-render
|
|
90
|
+
// entrance instead. The runtime still names no effect, and a deeper component's
|
|
91
|
+
// own motion is left alone.
|
|
85
92
|
function reveal(record) {
|
|
86
93
|
if (record.done) return;
|
|
87
94
|
record.done = true;
|
|
88
|
-
record.element.classList.remove(CLASSES.pending);
|
|
89
|
-
record.initialObserver.unobserve(record.element);
|
|
90
|
-
record.observer.unobserve(record.element);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Focus reached a pending element: the content must be usable on this frame,
|
|
94
|
-
// not after an entrance. Only the animations that releasing the state started
|
|
95
|
-
// are finished, found by difference, so the runtime still names no effect and
|
|
96
|
-
// leaves a nested component's own motion alone. A CSS :focus-within override
|
|
97
|
-
// cannot do this: it lapses on blur and the entrance replays from the start.
|
|
98
|
-
function revealNow(record) {
|
|
99
|
-
if (record.done) return;
|
|
100
95
|
const { element } = record;
|
|
101
96
|
const running = new Set(element.getAnimations({ subtree: true }));
|
|
102
|
-
|
|
97
|
+
element.classList.remove(CLASSES.pending);
|
|
98
|
+
record.initialObserver.unobserve(element);
|
|
99
|
+
record.observer.unobserve(element);
|
|
103
100
|
// getAnimations() flushes style, so the entrance released above is listed.
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
record.entrance = element.getAnimations({ subtree: true }).filter((animation) => {
|
|
102
|
+
const target = animation.effect?.target;
|
|
103
|
+
const owned = target === element || target?.parentElement === element;
|
|
106
104
|
// finish() throws on an animation that never ends.
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
return (
|
|
106
|
+
(owned || !running.has(animation)) &&
|
|
107
|
+
animation.effect?.getComputedTiming().endTime !== Infinity
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Focus entered the element: the content must be usable on this frame, not at
|
|
113
|
+
// the end of an entrance, whether the element was pending, just released or
|
|
114
|
+
// still playing its first-render entrance. A CSS :focus-within override cannot
|
|
115
|
+
// do this: on blur the entrance resumes from its timeline, or replays.
|
|
116
|
+
function revealNow(record) {
|
|
117
|
+
reveal(record);
|
|
118
|
+
for (const animation of record.entrance) {
|
|
119
|
+
if (animation.playState !== "finished") animation.finish();
|
|
109
120
|
}
|
|
121
|
+
record.entrance = [];
|
|
110
122
|
}
|
|
111
123
|
|
|
112
124
|
function cleanup(record, records) {
|
|
@@ -127,24 +139,23 @@ function connect(element) {
|
|
|
127
139
|
initialObserver: observer,
|
|
128
140
|
observer: triggerFor(connection, element.getAttribute("data-in-view-margin")),
|
|
129
141
|
done: false,
|
|
142
|
+
entrance: [],
|
|
130
143
|
controller: new AbortController(),
|
|
131
144
|
};
|
|
132
145
|
records.set(element, record);
|
|
133
146
|
|
|
134
|
-
// Focus may already sit inside the element before this registration (an
|
|
135
|
-
// autofocused control, a second runtime copy attaching late). Hiding it then
|
|
136
|
-
// would leave focus invisible until the observer's first callback.
|
|
137
|
-
if (element.contains(element.ownerDocument.activeElement)) {
|
|
138
|
-
reveal(record);
|
|
139
|
-
return () => cleanup(record, records);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
147
|
// Focus moves the page first, so this is the guarantee, not the observer:
|
|
143
|
-
// the element is visible by the time its descendant takes focus.
|
|
148
|
+
// the element is visible by the time its descendant takes focus. It stays
|
|
149
|
+
// after the release, while the entrance may still run.
|
|
144
150
|
element.addEventListener("focusin", () => revealNow(record), {
|
|
145
151
|
signal: record.controller.signal,
|
|
146
152
|
});
|
|
147
|
-
|
|
153
|
+
|
|
154
|
+
// Focus may already sit inside the element before this registration (an
|
|
155
|
+
// autofocused control, a second runtime copy attaching late). Hiding it then
|
|
156
|
+
// would leave focus invisible until the observer's first callback.
|
|
157
|
+
if (element.contains(element.ownerDocument.activeElement)) revealNow(record);
|
|
158
|
+
else observer.observe(element);
|
|
148
159
|
|
|
149
160
|
return () => cleanup(record, records);
|
|
150
161
|
}
|
package/src/js/menu.js
CHANGED
|
@@ -61,7 +61,7 @@ export function focusLastMenuItem(menu) {
|
|
|
61
61
|
lastItem(getMenuItems(menu))?.focus();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function onMenuKeydown(e, {
|
|
64
|
+
export function onMenuKeydown(e, { navigate = true } = {}) {
|
|
65
65
|
if (shouldIgnoreKey(e)) return;
|
|
66
66
|
const menu = e.currentTarget;
|
|
67
67
|
if (navigate) {
|
|
@@ -77,16 +77,10 @@ export function onMenuKeydown(e, { close, navigate = true }) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case "Enter":
|
|
85
|
-
case " ":
|
|
86
|
-
if (activateCurrentItem(menu)) {
|
|
87
|
-
e.preventDefault();
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
80
|
+
// No Tab case: the browser moves focus, and surface.js closes the menu once
|
|
81
|
+
// focus lands outside it, without bouncing focus through the trigger first.
|
|
82
|
+
if ((e.key === "Enter" || e.key === " ") && activateCurrentItem(menu)) {
|
|
83
|
+
e.preventDefault();
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
|
|
@@ -96,7 +90,7 @@ export function onMenuKeydown(e, { close, navigate = true }) {
|
|
|
96
90
|
// Each retain returns a release(); the wiring is torn down on the last one.
|
|
97
91
|
const menuConnections = new WeakMap();
|
|
98
92
|
|
|
99
|
-
export function connectMenu(menu
|
|
93
|
+
export function connectMenu(menu) {
|
|
100
94
|
let entry = menuConnections.get(menu);
|
|
101
95
|
|
|
102
96
|
if (!entry) {
|
|
@@ -109,15 +103,9 @@ export function connectMenu(menu, { close }) {
|
|
|
109
103
|
signal: controller.signal,
|
|
110
104
|
})
|
|
111
105
|
: null;
|
|
112
|
-
menu.addEventListener(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
onMenuKeydown(event, {
|
|
116
|
-
close: () => close(menu),
|
|
117
|
-
navigate: !focusGroup,
|
|
118
|
-
}),
|
|
119
|
-
{ signal: controller.signal },
|
|
120
|
-
);
|
|
106
|
+
menu.addEventListener("keydown", (event) => onMenuKeydown(event, { navigate: !focusGroup }), {
|
|
107
|
+
signal: controller.signal,
|
|
108
|
+
});
|
|
121
109
|
menu.addEventListener(
|
|
122
110
|
"click",
|
|
123
111
|
(event) => {
|
package/src/js/surface.js
CHANGED
|
@@ -428,9 +428,47 @@ function onDocumentClick(e) {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/*
|
|
432
|
+
* Focus that lands outside an open surface closes it, without moving focus:
|
|
433
|
+
* Tab, Shift+Tab or a script took it somewhere on purpose. Left open, the
|
|
434
|
+
* panel could cover the very control that just received focus (WCAG 2.4.11).
|
|
435
|
+
* Listening to where focus arrives, not to the Tab key, covers every route
|
|
436
|
+
* and leaves the browser's own sequential navigation untouched.
|
|
437
|
+
*
|
|
438
|
+
* What keeps a surface open: focus inside it, or on what opened it — any
|
|
439
|
+
* trigger naming it through aria-controls, the anchor, the source region of a
|
|
440
|
+
* context menu, or the element focus returns to. A context menu's trigger may
|
|
441
|
+
* be a point, so each one is checked as a Node. autoClose "false" is the
|
|
442
|
+
* application's explicit claim on closing, so focus leaves it alone too.
|
|
443
|
+
*/
|
|
444
|
+
function keepsSurfaceOpen(menu, state, target) {
|
|
445
|
+
if (menu.contains(target)) return true;
|
|
446
|
+
const owners = [
|
|
447
|
+
state.trigger,
|
|
448
|
+
state.source,
|
|
449
|
+
surfaceFocusReturns.get(menu),
|
|
450
|
+
...linkedTriggers(menu),
|
|
451
|
+
];
|
|
452
|
+
return owners.some((owner) => owner instanceof Node && owner.contains(target));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function onDocumentFocusIn(e) {
|
|
456
|
+
// composedPath() reaches past a shadow host to the element that took focus.
|
|
457
|
+
const target = e.composedPath()[0] ?? e.target;
|
|
458
|
+
if (!(target instanceof Node)) return;
|
|
459
|
+
|
|
460
|
+
for (const menu of [...openSurfaces]) {
|
|
461
|
+
if (menu.ownerDocument !== e.currentTarget) continue;
|
|
462
|
+
const state = surfaceMap.get(menu);
|
|
463
|
+
if (!state || state.autoClose === "false") continue;
|
|
464
|
+
if (!keepsSurfaceOpen(menu, state, target)) closeSurface(menu, { restoreFocus: false });
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
431
468
|
function ensureDocumentClick(menu) {
|
|
432
469
|
const doc = menu.ownerDocument;
|
|
433
470
|
if (!doc || clickBoundDocuments.has(doc)) return;
|
|
434
471
|
clickBoundDocuments.add(doc);
|
|
435
472
|
doc.addEventListener("click", onDocumentClick);
|
|
473
|
+
doc.addEventListener("focusin", onDocumentFocusIn);
|
|
436
474
|
}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* (`bun run report:theme-contrast`).
|
|
6
6
|
*
|
|
7
7
|
* Measured per island (one per color scheme the theme declares):
|
|
8
|
-
* -
|
|
8
|
+
* - what identifies a resting control against --surface (3:1): the edge of a
|
|
9
|
+
* field, checkbox and radio, the track edge or knob of an unchecked switch
|
|
9
10
|
* - soft ink against the resting and the hovered soft fill (4.5:1), on each
|
|
10
11
|
* surface a soft element sits on
|
|
11
12
|
* - the solid pairs, -fg on the intent fill (4.5:1); a fill painted by a
|
|
@@ -73,11 +74,15 @@ function islandMarkup(id, scheme) {
|
|
|
73
74
|
|
|
74
75
|
/* Controls whose resting edge is all that identifies them (WCAG 1.4.11): the
|
|
75
76
|
edge against the surface around them needs 3:1. The field is read on its
|
|
76
|
-
block-end side, the one an underline-only theme (material) keeps.
|
|
77
|
+
block-end side, the one an underline-only theme (material) keeps. An
|
|
78
|
+
unchecked switch is read on its track edge or its knob, whichever is
|
|
79
|
+
stronger: the core track is the --border-control edge, and a theme may move
|
|
80
|
+
the cue to a dark knob on a quiet track (docs/pages/forms/switch.md). */
|
|
77
81
|
export const CONTROLS = [
|
|
78
82
|
["field", '<input class="input">'],
|
|
79
83
|
["checkbox", '<input class="check" type="checkbox">'],
|
|
80
84
|
["radio", '<input class="radio" type="radio">'],
|
|
85
|
+
["switch", '<input class="switch" type="checkbox" role="switch">'],
|
|
81
86
|
];
|
|
82
87
|
|
|
83
88
|
const ratio = (fg, bg) => (fg[3] < 255 || bg[3] < 255 ? null : contrast(fg, bg));
|
|
@@ -140,7 +145,7 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
140
145
|
const colors = await view.evaluate(`(() => {
|
|
141
146
|
const rgba = ${RASTERIZE};
|
|
142
147
|
return [...document.querySelectorAll("[id^=island-]")].map((island) => {
|
|
143
|
-
const cs = (el) => getComputedStyle(el);
|
|
148
|
+
const cs = (el, pseudo = null) => getComputedStyle(el, pseudo);
|
|
144
149
|
const pairs = {};
|
|
145
150
|
for (const el of island.querySelectorAll("[data-pair]")) {
|
|
146
151
|
// The invalid field's block-end border carries --form-invalid-border,
|
|
@@ -201,11 +206,17 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
201
206
|
}
|
|
202
207
|
const box = island.querySelector("[data-controls]");
|
|
203
208
|
const controls = { backdrop: rgba(cs(box).backgroundColor), edges: {} };
|
|
209
|
+
// The cues that can identify each control; the best one counts. A field
|
|
210
|
+
// shows its lower edge, a switch its track edge or its knob (the core
|
|
211
|
+
// pill, or a theme's dark knob on a quiet track), any other control its
|
|
212
|
+
// edge.
|
|
213
|
+
const cues = {
|
|
214
|
+
field: (s) => [s.borderBlockEndColor],
|
|
215
|
+
switch: (s, el) => [cs(el, "::before").backgroundColor, s.borderTopColor],
|
|
216
|
+
};
|
|
204
217
|
for (const el of box.querySelectorAll("[data-control]")) {
|
|
205
|
-
const
|
|
206
|
-
controls.edges[el.dataset.control] = rgba
|
|
207
|
-
el.dataset.control === "field" ? s.borderBlockEndColor : s.borderTopColor,
|
|
208
|
-
);
|
|
218
|
+
const read = cues[el.dataset.control] ?? ((s) => [s.borderTopColor]);
|
|
219
|
+
controls.edges[el.dataset.control] = read(cs(el), el).map(rgba);
|
|
209
220
|
}
|
|
210
221
|
return { pairs, soft, solid, controls };
|
|
211
222
|
});
|
|
@@ -260,7 +271,11 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
260
271
|
value:
|
|
261
272
|
controls.backdrop[3] < 255
|
|
262
273
|
? null
|
|
263
|
-
:
|
|
274
|
+
: Math.max(
|
|
275
|
+
...controls.edges[kind].map((cue) =>
|
|
276
|
+
ratio(composite(cue, controls.backdrop), controls.backdrop),
|
|
277
|
+
),
|
|
278
|
+
),
|
|
264
279
|
})),
|
|
265
280
|
focusSurface: pair("focus-surface"),
|
|
266
281
|
focusSolid: pair("focus-solid"),
|
|
@@ -358,7 +373,7 @@ export function formatContrast(rows) {
|
|
|
358
373
|
);
|
|
359
374
|
}
|
|
360
375
|
|
|
361
|
-
lines.push("", "Control
|
|
376
|
+
lines.push("", "Control cue at rest (edge, or a switch's knob, vs --surface), needs 3:1.", "");
|
|
362
377
|
lines.push(`${"theme".padEnd(width)} scheme control ratio`);
|
|
363
378
|
for (const row of rows) {
|
|
364
379
|
for (const { kind, value } of row.controls ?? []) {
|
package/tokens.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Accessibility decisions
|
|
2
|
-
|
|
3
|
-
## Guarantees
|
|
4
|
-
|
|
5
|
-
Actual CSS makes the accessible path the default where CSS and small runtime enhancers can help.
|
|
6
|
-
|
|
7
|
-
- Visible `:focus-visible` styles on interactive components.
|
|
8
|
-
- Native elements first: `button`, `a`, `details`, `dialog`, form controls.
|
|
9
|
-
- Reduced motion support through shared duration tokens and the reset.
|
|
10
|
-
- Forced-colors support on controls and visual state indicators.
|
|
11
|
-
- DOM tests for enhancer lifecycle, focus, attributes, and keyboard behavior.
|
|
12
|
-
|
|
13
|
-
## Linters that reject ARIA patterns
|
|
14
|
-
|
|
15
|
-
Measured on Biome 2.5.6, in HTML and JSX alike.
|
|
16
|
-
|
|
17
|
-
`a11y/noNoninteractiveElementToInteractiveRole` reports `<menu role="menu">`,
|
|
18
|
-
and its fix removes the role, which dismantles the composite. It is a port of
|
|
19
|
-
`jsx-a11y/no-noninteractive-element-to-interactive-role` that dropped the source
|
|
20
|
-
rule's default allowlist, so every ARIA composite built on a list is reported —
|
|
21
|
-
`menu`, `listbox`, `tablist`, `menubar`, `tree`, `grid` — even though the source
|
|
22
|
-
documents `<ul role="menu">` as valid. Switch the rule off; a per-element
|
|
23
|
-
suppression would sit above every menu in the markup.
|
|
24
|
-
|
|
25
|
-
`a11y/useSemanticElements` reports `role="group"` on `.join` and
|
|
26
|
-
`.avatar-stack`, suggesting `<fieldset>`. `<fieldset>` groups form controls
|
|
27
|
-
under a `<legend>`; ARIA's `group` is any labelled set of related objects. This
|
|
28
|
-
rule stays on — it correctly catches `<div role="navigation">`,
|
|
29
|
-
`<div role="button">`, `<div role="separator">` — so suppress it on the wrapper
|
|
30
|
-
instead. A wrapper with no label to give should drop the role rather than
|
|
31
|
-
suppress the rule.
|
|
32
|
-
|
|
33
|
-
Two decisions these findings settled:
|
|
34
|
-
|
|
35
|
-
- `.join` keeps `role="group"` rather than `role="toolbar"`, which the rule does
|
|
36
|
-
not report. Toolbar owes arrow-key navigation with a roving tabindex, and
|
|
37
|
-
claiming the role without the behaviour is worse than the false positive.
|
|
38
|
-
- `.menu-separator` is an empty `<li>` because list containers require list
|
|
39
|
-
rows. An ARIA menu exposes that divider with `role="separator"`. A native
|
|
40
|
-
list hides the decorative row with `aria-hidden="true"` so it contributes no
|
|
41
|
-
empty list item. Scope any Biome `a11y/useSemanticElements` suppression to
|
|
42
|
-
the ARIA divider, since its suggested `<hr>` would break the content model.
|
|
43
|
-
|
|
44
|
-
## Author Responsibilities
|
|
45
|
-
|
|
46
|
-
- Name icon-only buttons.
|
|
47
|
-
- Use the ARIA attributes shown in examples.
|
|
48
|
-
- Keep form errors inline and connected with `aria-describedby`.
|
|
49
|
-
- Do not put critical information only in a transient notification.
|
|
50
|
-
|
|
51
|
-
## Interactive states
|
|
52
|
-
|
|
53
|
-
- Interactive controls must be identifiable at rest, either by their own styling or by clear surrounding context.
|
|
54
|
-
- Interactive states are: rest, hover, active / pressed, focus-visible, disabled, selected / current / expanded (when applicable).
|
|
55
|
-
- Do not rely on hover alone to reveal interactivity.
|
|
56
|
-
- Do not use color alone to communicate state.
|
|
57
|
-
- Use structure, border, background, iconography, and spacing consistently.
|
|
58
|
-
- Select controls stay quieter than text inputs: hover uses a subtle surface change, while focus-visible and open states use a soft ring in normal color modes.
|
|
59
|
-
- Forced-colors keeps strong outlines for select focus/open states, high-contrast option hover/focus states, and a selected checkmark that inherits the option text color unless the option is highlighted.
|
|
60
|
-
- Global Escape handlers only prevent default when Actual has a visible managed surface to close.
|
|
61
|
-
- Prefer explicit `data-filter` values in examples and docs. Empty `data-filter`
|
|
62
|
-
does not infer behavior from `inputmode`: keyboard hints and destructive value
|
|
63
|
-
filtering remain separate contracts.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Application UI boundaries
|
|
2
|
-
|
|
3
|
-
Actual CSS provides application chrome and content composition without owning
|
|
4
|
-
the application lifecycle.
|
|
5
|
-
|
|
6
|
-
```text
|
|
7
|
-
app-shell full-height single-column document flow
|
|
8
|
-
sidebar-shell persistent side region + main, each scrolling, on a wide viewport
|
|
9
|
-
topbar persistent top application chrome
|
|
10
|
-
app-layout specialized topbar + internal scroll + adaptive navigation recipe
|
|
11
|
-
app-nav primary application destinations
|
|
12
|
-
list repeated application rows with leading/content/trailing regions
|
|
13
|
-
status-bar passive transient feedback
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
`app-layout` is selected by that complete behavior, never by product category.
|
|
17
|
-
Public sites and applications with ordinary document scrolling stay on
|
|
18
|
-
semantic landmarks and may use `app-shell`; a site header uses `navbar`.
|
|
19
|
-
|
|
20
|
-
Routing, navigation history, application state, SPA page lifecycle, service
|
|
21
|
-
workers, manifests, offline policy, and install prompts belong to the
|
|
22
|
-
application. Actual does not prescribe Material breakpoints or device classes;
|
|
23
|
-
the application layout changes when its available viewport can accommodate
|
|
24
|
-
labelled side navigation.
|
|
25
|
-
|
|
26
|
-
## Sidebar shell
|
|
27
|
-
|
|
28
|
-
An admin or dashboard keeps a sidebar beside its content on a wide screen and
|
|
29
|
-
hands it to a drawer on a phone. None of the existing shapes is that:
|
|
30
|
-
`.app-shell` is one column, `.sidebar-layout` a wrapping pair inside a page,
|
|
31
|
-
and `.app-layout` moves navigation to a bottom bar.
|
|
32
|
-
|
|
33
|
-
Contract:
|
|
34
|
-
|
|
35
|
-
- Two direct children: an `aside` (the side region, any content) and one
|
|
36
|
-
other element (the main region). The drawer is a separate `dialog.drawer`
|
|
37
|
-
outside the shell; the two are never one element transformed.
|
|
38
|
-
- At `64rem` and up, a viewport-height grid, side then main. Each region
|
|
39
|
-
scrolls on its own, so the sidebar never scrolls away with the content.
|
|
40
|
-
- Below `64rem`, the side region is hidden and the document scrolls. A phone
|
|
41
|
-
keeps its native behaviors: the collapsing URL bar, tap-to-top, and a
|
|
42
|
-
virtual keyboard that resizes the document rather than a fixed box.
|
|
43
|
-
- The breakpoint is a literal: a custom property cannot sit in a media
|
|
44
|
-
condition. A project that needs another one copies the two rules.
|
|
45
|
-
- Hidden with `(width < 64rem)`, not shown above it: the side region keeps
|
|
46
|
-
the author's own `display` (an `aside.stack`). Where range syntax is
|
|
47
|
-
unsupported the rule drops and the sidebar stacks above the content, still
|
|
48
|
-
reachable.
|
|
49
|
-
- CSS only. Closing an open drawer when the viewport widens belongs to the
|
|
50
|
-
page (`matchMedia` change → `dialog.close()`), a documented recipe rather
|
|
51
|
-
than a watcher in the primitive.
|
|
52
|
-
- Print is one flow, side then main, nothing clipped. The narrow rule is
|
|
53
|
-
`screen` only: print never hides framework content, so leaving the sidebar
|
|
54
|
-
off paper is the application's print stylesheet.
|
|
55
|
-
|
|
56
|
-
Rejected: a bottom navigation (that is `.app-layout`), a collapsible icon rail
|
|
57
|
-
(an application state), and a breakpoint hook (impossible in a media query).
|
|
58
|
-
|
|
59
|
-
Compact UI vocabulary remains semantic rather than shape-driven:
|
|
60
|
-
|
|
61
|
-
- use `.btn.sm` for compact actions and `aria-pressed` filters;
|
|
62
|
-
- use `.badge` for passive counts, statuses, and categories;
|
|
63
|
-
- use `.badge` with a `.close` button when a displayed tag can be removed;
|
|
64
|
-
- use `.status-bar` for passive feedback, not an actionable toast.
|
|
65
|
-
|
|
66
|
-
There is no generic chip or snackbar component. Those names conflate different
|
|
67
|
-
HTML semantics that the existing components already keep explicit.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
|
|
3
|
-
How to decide what belongs in Actual, and where. The rules an application
|
|
4
|
-
author follows are in [Philosophy](../pages/foundations/philosophy.md) and
|
|
5
|
-
[Building with Actual CSS](../pages/guides/integrating-actual-css.md); naming is
|
|
6
|
-
in [Naming conventions](naming.md), behavior in
|
|
7
|
-
[Enhancement contract](enhancement-contract.md).
|
|
8
|
-
|
|
9
|
-
The test for where a rule goes: if it changes how someone writes their
|
|
10
|
-
application CSS, it belongs in the guide; if it only decides how Actual is
|
|
11
|
-
built, it belongs here.
|
|
12
|
-
|
|
13
|
-
## Ownership
|
|
14
|
-
|
|
15
|
-
- **A component owns its intrinsic anatomy, not page composition.** Padding,
|
|
16
|
-
surface, slots and states are the component's; outer margins and sibling
|
|
17
|
-
spacing are not.
|
|
18
|
-
- **A layout primitive on a component replaces its default layout without
|
|
19
|
-
specificity tricks.** The component's own box layout sits in `:where()`
|
|
20
|
-
(`.card`, its header and footer slots). `components/` loads after `layout/`,
|
|
21
|
-
so a plain class declaration would win on source order and flatten
|
|
22
|
-
`class="card media"` into a column.
|
|
23
|
-
- **Structural anatomy never lends a class's weight to a bare element.**
|
|
24
|
-
`:where(dialog).modal > :where(form, .stack)`, not `> :is(form, .stack)`,
|
|
25
|
-
which would give `<form>` the specificity of `.stack`.
|
|
26
|
-
|
|
27
|
-
## Utilities
|
|
28
|
-
|
|
29
|
-
A utility makes one reusable adjustment. A class that sets a surface, a border,
|
|
30
|
-
padding and type together has become a component, whatever file it lives in.
|
|
31
|
-
|
|
32
|
-
## Abstraction
|
|
33
|
-
|
|
34
|
-
- **Duplication beats an abstraction that couples unrelated components.** Every
|
|
35
|
-
file under `components/` is a public export (`actual-css/css/components/*`).
|
|
36
|
-
A shared file imported only by the index would break a single-component
|
|
37
|
-
import, so `.modal` and `.drawer` each keep the declarations they share.
|
|
38
|
-
- **No generic primitive because two examples look alike.** A primitive names a
|
|
39
|
-
relationship that recurs across unrelated applications. When the existing
|
|
40
|
-
answer was hard to find, improve the docs instead.
|
|
41
|
-
- **Bytes do not justify specificity.** A selector is not merged or raised to
|
|
42
|
-
save a few compressed bytes when it changes who can override it.
|
|
43
|
-
|
|
44
|
-
## Tokens
|
|
45
|
-
|
|
46
|
-
See [Token architecture](tokens.md) for scope, inheritance, size and density,
|
|
47
|
-
color interpolation, motion, and component mapping constraints.
|
|
48
|
-
|
|
49
|
-
A value derived from an overridable token is computed on the element that uses
|
|
50
|
-
it, never as an alias on `:root`: an inherited custom property arrives already
|
|
51
|
-
computed, so an override on a theme island or a region would not reach it. The
|
|
52
|
-
generic focus line (`focus.css`) and the dialog and drawer focus reserves
|
|
53
|
-
follow this rule.
|
|
54
|
-
|
|
55
|
-
## Decoration
|
|
56
|
-
|
|
57
|
-
A decorative cue must not dictate geometry, focus or scroll behavior. Scrolling
|
|
58
|
-
strips have no shared edge fade: its mask set their scroll-padding and focus
|
|
59
|
-
reserve, and repeated what a clipped item and the scrollbar already show. The
|
|
60
|
-
strips reserve only their focus line. `.tabs` is the exception: it hides its
|
|
61
|
-
scrollbar, so its fade is the cue, and the fade spans the strip's existing
|
|
62
|
-
scroll-padding instead of setting it.
|
|
63
|
-
|
|
64
|
-
Starting a strip on its current item is a progressive enhancement, not a
|
|
65
|
-
contract: `scroll-initial-target` on the item, no runtime. One declaration
|
|
66
|
-
replaces a module, its opt-in token and its wait for parsing. Engines without
|
|
67
|
-
the property start at the first item, which the fade or the scrollbar already
|
|
68
|
-
says is not all; do not reintroduce a script fallback for them. `.pagination` does not scroll at all: it wraps, because a
|
|
69
|
-
click on a page navigates instead of moving the strip, so a scrolling row hid
|
|
70
|
-
pages the mouse could not reach.
|