actual-css 0.19.3 → 0.19.5

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 (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/dist/actual.full.css +8 -4
  4. package/dist/actual.full.js +2 -2
  5. package/dist/actual.full.min.css +1 -1
  6. package/dist/types/surface-focus.d.ts +2 -0
  7. package/docs/pages/components/dialog.md +3 -0
  8. package/docs/pages/components/list.md +1 -1
  9. package/docs/pages/components/timeline.md +4 -2
  10. package/docs/pages/enhancements/flyout.md +26 -8
  11. package/docs/pages/forms/joined-controls.md +1 -1
  12. package/docs/pages/forms/switch.md +4 -2
  13. package/docs/pages/foundations/theming.md +3 -0
  14. package/docs/pages/foundations/tokens.md +13 -13
  15. package/llms.txt +3 -3
  16. package/package.json +4 -5
  17. package/src/cli/actual-css.js +3 -3
  18. package/src/css/components/menu.css +2 -2
  19. package/src/css/forms/switch.css +6 -2
  20. package/src/js/dialog.js +30 -11
  21. package/src/js/surface-focus.js +14 -0
  22. package/src/js/surface.js +8 -3
  23. package/src/tooling/theme-contrast.js +6 -2
  24. package/docs/design-notes/accessibility-decisions.md +0 -65
  25. package/docs/design-notes/app-ui.md +0 -67
  26. package/docs/design-notes/architecture.md +0 -70
  27. package/docs/design-notes/browser-support.md +0 -239
  28. package/docs/design-notes/cascade-layer.md +0 -74
  29. package/docs/design-notes/column-layout.md +0 -260
  30. package/docs/design-notes/css-anchor.md +0 -87
  31. package/docs/design-notes/enhancement-contract.md +0 -193
  32. package/docs/design-notes/forced-colors.md +0 -123
  33. package/docs/design-notes/grid.md +0 -785
  34. package/docs/design-notes/motion-cost.md +0 -62
  35. package/docs/design-notes/naming.md +0 -71
  36. package/docs/design-notes/platform-alignment.md +0 -602
  37. package/docs/design-notes/popover-manual-poc.md +0 -328
  38. package/docs/design-notes/references.md +0 -336
  39. package/docs/design-notes/rich-text.md +0 -61
  40. package/docs/design-notes/spacing-units.md +0 -286
  41. package/docs/design-notes/steps.md +0 -776
  42. package/docs/design-notes/surface-reparenting.md +0 -130
  43. package/docs/design-notes/tokens.md +0 -166
  44. package/docs/design-notes/tooltip-coordinate-space.md +0 -130
  45. package/docs/design-notes/widget-primitives.md +0 -144
  46. package/docs/navigation.json +0 -176
@@ -1,776 +0,0 @@
1
- # Steps: representations, thresholds, and selector shapes
2
-
3
- ## Status
4
-
5
- This document holds the reasoning behind `steps.css`: why the component has the
6
- representations it has, why the threshold sits where it sits, and which
7
- plausible alternatives are wrong and by how much.
8
-
9
- Its job is to keep the constraints legible, so a change that would reintroduce
10
- a shape this component measures as worse can be recognised as such. Everything
11
- here is stated as the design is, with the measurement that settles it — not as
12
- a record of what changed when. That belongs in the changelog.
13
-
14
- ## The markup contract
15
-
16
- One primitive, two explicit compositions. Both classes are required:
17
-
18
- ```html
19
- <ol class="steps steps-horizontal">…</ol> <!-- 2 to 5 stages -->
20
- <ol class="steps steps-vertical">…</ol> <!-- no count limit -->
21
- ```
22
-
23
- `.steps` is what a step *is*; the second class is what the sequence *looks
24
- like*. A step is therefore the same thing in both.
25
-
26
- `.step-label` is then the other decision, and it is **independent of the
27
- first**: it says whether the sequence carries its own step names. Optional in
28
- either orientation; when a sequence carries names, every step carries one.
29
-
30
- ```html
31
- <!-- the page carries the name; the sequence draws the position -->
32
- <ol class="steps steps-horizontal" aria-hidden="true">
33
- <li class="step-complete"></li>
34
- <li aria-current="step"></li>
35
- <li></li>
36
- </ol>
37
-
38
- <!-- the sequence carries the names -->
39
- <ol class="steps steps-horizontal">
40
- <li class="step-complete"><a class="step-label" href="/account">Account</a></li>
41
- <li aria-current="step"><span class="step-label">Validation</span></li>
42
- <li><span class="step-label">Payment</span></li>
43
- </ol>
44
- ```
45
-
46
- Two dimensions, four compositions:
47
-
48
- | | empty steps | `.step-label` on every step |
49
- | -------------- | ------------------- | ------------------------------------- |
50
- | **horizontal** | compact progression | named sequence, stacked or inline |
51
- | **vertical** | compact rail | named sequence, labels beside markers |
52
-
53
- The two forms are not two densities of the same thing. They show different
54
- information, which is why the contract splits on content rather than on a
55
- width. And the split is not the component's invention: a step with nothing in
56
- it *is* just a marker. "Markers only" is not a variant — it is what a step
57
- naturally is when it has no content.
58
-
59
- A label may be an `a[href]` where the workflow allows navigation. That is the
60
- whole interactive surface and it belongs to labels alone, which is the same
61
- rule read from the other end: navigating a flow means naming its destinations —
62
- see "Navigation is a labelled affair".
63
-
64
- ### Why `.step-complete` is prefixed
65
-
66
- The framework writes modifiers bare — `<button class="btn primary outline lg">`
67
- — and a bare `.complete` would look like it belongs to that grammar. It does
68
- not. Those modifiers qualify a component on the component's own element; this
69
- one marks one item *inside* a component, which is the position `.step-label`
70
- occupies. Prefixing keeps the component's public vocabulary in one namespace:
71
- `steps`, `steps-horizontal`, `steps-vertical`, `step-label`, `step-complete`,
72
- beside `aria-current="step"`.
73
-
74
- It also keeps the framework from claiming `complete` — an ordinary English word
75
- an application is likely to want for a task, a download or a form — as a
76
- reserved global class, for one component's one state.
77
-
78
- Complete is the only state with a class at all. Current is `aria-current="step"`
79
- and upcoming is the absence of both, because the platform already spells those.
80
-
81
- ### Bare text in an `<li>`
82
-
83
- Out of contract — a step name belongs in a `.step-label` — and it degrades in
84
- the right direction. `:empty` reads an item's own content, so `<li>Account</li>`
85
- is not empty: it takes the same authored item floor as a wrapped label, and only the
86
- placing and aligning that `.step-label` rules provide are missing. It lays out
87
- and does not fall apart, which is all an out-of-contract markup is owed.
88
-
89
- This is the case that makes bare text expensive to support as a first-class
90
- form, and it is worth stating precisely, because a component that sizes steps
91
- *per label* pays for it twice.
92
-
93
- In behaviour: sizing by `> li:has(.step-label)` would give bare text and
94
- wrapped labels different floors whenever an author sets `--step-min`.
95
-
96
- In bytes: the only valid way to express "every step is wrapped" is to enumerate
97
- positions (see "`:has()` cannot be nested"), which grows the selector for each
98
- supported count.
99
-
100
- `:empty` avoids both by asking the question that actually decides the layout —
101
- *is there anything in this step?* — and answering it the same way for a label,
102
- a link and bare text.
103
-
104
- The row-level alternative, `.steps-horizontal:not(:has(.step-label)) > li`,
105
- avoids the skew differently: it gives every step the authored floor, so an empty
106
- step in a mixed row becomes a wide gap rather than a marker. It also puts the
107
- compact form itself behind `:has()`, above the Degraded tier, for a shape that
108
- needs no modern selector at all.
109
-
110
- ### `:empty` means empty
111
-
112
- No children, no text — not even whitespace. `<li></li>` is a marker;
113
- `<li>\n</li>` is not. Comments are allowed.
114
-
115
- That is a sharp edge, and it is the framework's existing one: `.badge:empty`
116
- draws the same line, so it is not a new convention for an author to learn. It
117
- is documented next to the markup that relies on it.
118
-
119
- ## Why there is one threshold
120
-
121
- ```text
122
- >= 60rem marker beside label
123
- otherwise stacked
124
- ```
125
-
126
- Only labelled rows see it. An unlabelled row is already the shape the query
127
- produces, so it stays out — one representation at every width, which is what
128
- lets it be documented as unconditional.
129
-
130
- One threshold, and no per-count variants of it: see "Nothing counts the steps".
131
-
132
- **60rem is where the inline connector survives on five steps.** Inline is a
133
- bonus for generous room, not a rescue, so a late threshold costs nothing and one
134
- threshold can serve every count. But it cannot be arbitrary: the connector
135
- absorbing the free space between marker + label groups is the representation's
136
- defining feature, and the region a theme replaces with a chevron.
137
-
138
- Measured with five steps and realistic labels ("Personal details", "Delivery
139
- address", "Shipping method", …), the connector width is:
140
-
141
- | Container | 768px | 832px | 896px | 960px | 1024px |
142
- | --------- | ----- | ----- | ----- | ----- | ------ |
143
- | connector | 15px | 24px | 33px | 49px | 65px |
144
-
145
- At 48rem (768px) the row renders inline with a 15px connector — the
146
- representation applies, but its point has collapsed to a stub. 60rem is the
147
- first threshold where five steps still clear the connector's own `2rem`
148
- flex-basis. Four steps reach 58px already at 768px, and two or three steps have
149
- room to spare, so calibrating on five costs the smaller counts only a longer
150
- stay in the stacked layout.
151
-
152
- **The threshold is literal rem.** `@container` cannot resolve a custom
153
- property, so overriding `--step-min` moves the scroll budget but not this
154
- query. Same trade as `--grid-min` in `grid.css`.
155
-
156
- ## Even marker pitch and wrapping labels
157
-
158
- Stacked labelled steps keep an even marker pitch because each outgoing
159
- connector must reach the next marker's edge. Intrinsic per-label widths would
160
- move the markers unevenly and make that length depend on a neighbour's width.
161
-
162
- The first and last markers align with the row's edges at every width. Each
163
- end cell takes half a normal share plus half a marker; simply moving the marker
164
- inside a full cell would stretch the outer connectors. Labels follow the same
165
- start/end alignment, while the middle steps remain centred. The first connector
166
- crosses two end-cell widths minus both markers, plus the intervening gap.
167
-
168
- It is not behind a viewport query. Edge alignment is the row's geometry, the
169
- one the compact and inline forms already have, and a breakpoint on the viewport
170
- would lay out the same 600px row differently on a phone and in a desktop card.
171
-
172
- The end labels pay for that alignment: each gets half a share, and that is
173
- already all the room it can have. Two neighbouring labels meet at the midpoint
174
- between their markers, and an end label already runs from the row's edge to
175
- that midpoint, so widening it would let it overlap a long neighbour. Giving the
176
- end labels a full share means centring them under inset markers, which gives
177
- up the edge alignment. That is a design trade, not a technical limit, and it
178
- stays open to re-evaluation if narrow rows need longer end names.
179
-
180
- The marker sets the default item floor. A `minmax(0, 1fr)` grid column keeps a
181
- long label from widening its step; `hyphens: auto` breaks a long word where the
182
- browser has a dictionary for the page's `lang`, and `overflow-wrap: anywhere`
183
- still lets an unbroken name fit when it does not. Automatic hyphenation is not
184
- a contract: headless Chrome hyphenates `account` but breaks `Account` as
185
- `Accoun`/`t`, and most labels are capitalised. An authored `&shy;` is the
186
- predictable break. `--step-gap` separates both the marker from its label and
187
- one step from the next, so wrapped names cannot run together.
188
-
189
- Authors can raise `--step-min` when wrapping costs too much height. The row
190
- then scrolls once those floors and the intervening gaps outgrow its region.
191
- This budget changes neither orientation nor the wide inline threshold.
192
-
193
- ## The compact form
194
-
195
- The whole unlabelled contract, in both orientations:
196
-
197
- ```css
198
- .steps-horizontal > li:empty {
199
- flex: 1 1 0;
200
- justify-items: start;
201
- min-inline-size: var(--step-size);
202
- }
203
-
204
- .steps-horizontal > li:empty::after {
205
- inset-inline-start: var(--step-size);
206
- }
207
-
208
- .steps-horizontal > li:empty:last-child {
209
- flex: 0 0 auto;
210
- }
211
-
212
- .steps-vertical > li:empty {
213
- grid-template-columns: var(--step-size);
214
- }
215
- ```
216
-
217
- The CSS then reads almost as the public contract does:
218
-
219
- ```css
220
- .steps-horizontal > li { /* marker over label */ }
221
- .steps-horizontal > li:empty { /* marker only */ }
222
- .steps-vertical > li { /* marker beside label */ }
223
- .steps-vertical > li:empty { /* marker only */ }
224
-
225
- @container actual-container (inline-size >= 60rem) {
226
- .steps-horizontal:has(.step-label) > li { /* optional wide enhancement */ }
227
- }
228
- ```
229
-
230
- ### Why the row's rule is two declarations and the column's is one
231
-
232
- The row's base rule describes a step, not a stacked step:
233
-
234
- ```css
235
- .steps-horizontal > li {
236
- display: grid;
237
- grid-template-rows: var(--step-size); /* the marker's row, and only it */
238
- gap: var(--step-gap);
239
- …
240
- }
241
- ```
242
-
243
- The template declares one track. A `.step-label` is auto-placed into an
244
- implicit second row, and `gap` only means something once there are two tracks —
245
- so an empty step is exactly `--step-size` tall, with no empty track and no gap
246
- for `:empty` to take back. `grid-template-rows: var(--step-size) auto` builds
247
- that second row whether or not a label ever arrives, and the compact rule then
248
- has to remove the track *and* the gap. What is left to say is only the sizing:
249
-
250
- ```text
251
- li:empty only the marker marker floor equal share of the line
252
- li with .step-label a second row --step-min a readable share
253
- ```
254
-
255
- The column cannot use that mechanism, and the reason is worth recording so it
256
- is not "simplified" later: **`grid-auto-flow` is `row`**, so an auto-placed
257
- label lands *under* its marker rather than beside it. Its second track is
258
- therefore explicit, and `:empty` takes it back — one declaration, since a
259
- single track has nothing for `gap` to sit beside.
260
-
261
- ### Why the track runs edge to edge
262
-
263
- `justify-items: start` on an empty step is not an override of the row's
264
- centring, and the distinction matters because it looks like one. A marker is
265
- centred in its share because a label sits under it and the two must share a
266
- centre. With no label there is nothing to centre against, so the marker takes
267
- the start of its share, its connector fills the rest, and the final step —
268
- having no share to fill — is only as wide as its own marker.
269
-
270
- The result is a track flush with both ends of the row, which is what lets it
271
- line up with the heading or paragraph that names the step. Keeping the centred
272
- geometry leaves half-cell margins at both ends, with the first marker floating
273
- inward of a left-aligned heading.
274
-
275
- It also matches the inline representation, whose `:last-child { flex: 0 0 auto }`
276
- is the same declaration for the same reason.
277
-
278
- The connector follows from the alignment rather than being tuned to it. The
279
- base geometry starts a connector at `50% + --step-size / 2` — the right edge of
280
- a centred marker — and runs it `100% - --step-size + --step-gap`, to the next marker's left
281
- edge. Move the marker to the start of the share and that origin becomes
282
- `--step-size`; the width is unchanged, and the connector still lands exactly on
283
- the next marker. Measured at 736px and at 200px: zero gap either side.
284
-
285
- ### What the column's rule buys
286
-
287
- Nothing visible in a stretched column: a flex item in a column container fills
288
- its line whatever its tracks say, so the marker, the connector and the item's
289
- box all measure identically either way. Only `grid-template-columns` changes.
290
-
291
- It earns its place in a **shrink-to-fit box** — which is what a sticky progress
292
- rail usually is. Measured at three empty steps in an `inline-size: max-content`
293
- wrapper: **36px without the rule, 28px with it.** The 8px is `--step-inline-gap`,
294
- the gap to a label track holding nothing. A rail eight pixels wider than the
295
- markers it draws is not a bug anyone would file, and also not something to
296
- leave in a component whose whole claim is that sizing follows content.
297
-
298
- ### Why `:empty` rather than `:has()`
299
-
300
- It says what the markup says, and it reads the item's own content, which is
301
- what keeps bare text on the same authored floor as labelled peers (see "Bare text in an `<li>`").
302
-
303
- It also predates `:has()` by a decade, so the compact form reaches the Degraded
304
- tier. `:has(.step-label)` appears only in the wide container query, where
305
- losing it costs the inline bonus and nothing structural. So the support story
306
- has no hole in it:
307
-
308
- ```text
309
- no :has(), no container queries both compact forms work; labelled stays stacked
310
- :has() + container queries labelled rows also go inline past 60rem
311
- ```
312
-
313
- ## Selector shapes
314
-
315
- ### `:has()` cannot be nested
316
-
317
- `:has()` is not valid inside `:has()`, including indirectly through `:not()` or
318
- `:is()`. The whole selector is discarded — silently, so the rule simply never
319
- applies. Chrome throws on `document.querySelector` for it, which is the cheapest
320
- way to check.
321
-
322
- This rules out the natural spelling of "every step is labelled":
323
-
324
- ```css
325
- /* INVALID — the rule never applies */
326
- .steps:not(:has(> li:not(:has(> .step-label))))
327
- ```
328
-
329
- When a count is already known, the workaround is to enumerate positions, each in
330
- its own flat clause, folding the last into the count check:
331
-
332
- ```css
333
- .steps:has(> :nth-child(1) > .step-label):has(> :nth-child(2):last-child > .step-label)
334
- ```
335
-
336
- That is the strict all-or-nothing label check, and it costs one clause per
337
- position per rule.
338
-
339
- Nothing needs it, because nothing asks that question. Sizing is decided per
340
- item, by `:empty`, so no rule needs to know what the *sequence* contains; only
341
- the wide enhancement asks about labels at all, and it asks the loose version:
342
-
343
- ```css
344
- .steps-horizontal:has(.step-label) > li /* some step is labelled */
345
- ```
346
-
347
- One flat clause at any count. It cannot express "every step is labelled", so
348
- all-or-nothing is enforced by documentation rather than by the selector — and
349
- the strict version would cost the enumeration above on every rule, to improve
350
- markup that is already wrong. What the loose clause gives a mixed row is the
351
- inline treatment for all of its steps, which is the harmless direction: each
352
- item is still sized on its own content.
353
-
354
- ### Nothing counts the steps
355
-
356
- No selector in the component reads `:nth-child`, and none needs to. Whether a
357
- step is compact is decided by that step's content, at every width.
358
-
359
- A count check is the natural instinct for a stepper, so it is worth stating
360
- what it would be for and why the component declines it. A representation that
361
- *hides* labels below a width only helps at four or five steps — two or three
362
- stay readable stacked far below any width worth designing for — so it needs a
363
- lower bound:
364
-
365
- ```css
366
- /* four steps or more */
367
- :has(> :nth-child(4))
368
- ```
369
-
370
- and, to keep a 6+ row on the base layout, one of two upper bounds as well:
371
-
372
- ```css
373
- /* exactly 4 or 5 */
374
- :has(> :nth-child(4):last-child, > :nth-child(5):last-child)
375
-
376
- /* at least 4, fewer than 6 */
377
- :has(> :nth-child(4)):not(:has(> :nth-child(6)))
378
- ```
379
-
380
- Both upper bounds are defensible as "the enumeration *is* the contract" — the
381
- selector stating the supported counts. That argument holds only if 6+
382
- horizontal is a case worth serving carefully. It is not. It is out of contract,
383
- and the enumeration buys it a curated fallback at the cost of four
384
- `:nth-child` clauses on every rule of the block, on every row that *is*
385
- supported.
386
-
387
- So a 6+ row goes inline at wide widths, calibrated for a count it does not
388
- have. That is what out of contract means: the rules apply as written. The docs
389
- say 2 to 5 and point longer sequences at `.steps-vertical` rather than promising
390
- a graceful degradation nobody asked for.
391
-
392
- The tests hold the same line: there is no six-step fixture. Pinning what such a
393
- row does — "no rule fires", or "it compacts" — turns an accident of the
394
- selectors into an API nobody promised, and would have to be revisited every
395
- time a threshold moved. What is out of contract is not tested for behaviour.
396
-
397
- Vertical is the other thing a rule might need to exclude, and it needs no guard
398
- either: the container query addresses `.steps-horizontal` by name, so there is
399
- nothing to exclude. See "Two compositions, one primitive".
400
-
401
- ### The containment grant
402
-
403
- The inline representation reads the nearest `actual-container` size context,
404
- which the author grants — with the `.container-query` class or by declaring the
405
- name in their own CSS — on the row or on a region around it. It is not granted
406
- by the component, because `container-type: inline-size` collapses `.steps` to
407
- roughly zero in any shrink-to-fit box: a float, an inline-block, a table cell, a
408
- grid auto track, an absolutely positioned box, a `max-content` parent. Block flow
409
- and `.cluster` are safe.
410
-
411
- Containment is also what makes the condition stable: content cannot perturb the
412
- container's width, so the query cannot be flipped by its own effect.
413
-
414
- The name is shared rather than steps-specific, so one grant serves every
415
- size-aware component in a region.
416
-
417
- The grant is an enhancement in both directions. An unlabelled sequence needs
418
- none — its shape is intrinsic, in either orientation. A labelled one needs none
419
- either: stacked is the baseline, and the grant only buys the wide composition.
420
- **The container does not rescue the component; it improves how it composes.**
421
-
422
- ### Navigation is a labelled affair
423
-
424
- Only a `.step-label` can be a link, so navigation and labels are one decision.
425
- A marker is never interactive, which rules out the doubtful case directly: five
426
- clickable circles with no visible name.
427
-
428
- That single rule is also what keeps a focus guard out of the layout. `.sr-only`
429
- leaves an element in the tab order at 1×1 under `clip-path: inset(50%)`, so a
430
- focus ring lands on nothing — and a component that hides labels to fit needs to
431
- refuse any row whose labels are navigable:
432
-
433
- ```css
434
- :not(:has(a[href]))
435
- ```
436
-
437
- Such a guard has to read structure rather than state, because `aria-current`
438
- moves as the workflow advances and the same link goes future → current →
439
- complete: a state-keyed guard flickers under the user. It also has to be
440
- deliberately loose — `:has(a[href])` reads the whole subtree — since refusing on
441
- more than you promise is the safe direction. None of that is needed here:
442
- nothing hides a label, so no rule has to ask whether hiding one would be safe.
443
-
444
- The contract is one sentence. A step label may be a link, a marker never is, and
445
- anything else focusable in a step is out of contract.
446
-
447
- The one `:has(a[href])` in the file is unrelated: a navigable row reserves
448
- padding on both axes for its focus ring, because the scroll container clips at the
449
- padding edge. See "Scrolling on one axis".
450
-
451
- A link needs no styling rule of its own to go with it. `color: inherit` sits in
452
- the `.steps .step-label` rule: a span inherits its ink anyway, so only a link
453
- has a `--link` colour to take back, and taking it back for every label costs
454
- nothing and one rule less. That rule stays scoped to `.steps` — unlike
455
- `.menu-item-text` and the framework's other sub-part classes — because a bare
456
- `.step-label` weighs (0,1,0), exactly `.prose :where(a)`, so a stepper inside
457
- prose would be decided by the order the bundle concatenates two files in.
458
-
459
- ## Why nothing hides a label
460
-
461
- **The framework does not silently remove content to solve a layout problem.**
462
- That is the sentence the whole component turns on, and it is worth defending in
463
- detail, because hiding labels below a width is the obvious design for a
464
- stepper and it is a well-measured trap.
465
-
466
- ### The shape it rules out
467
-
468
- A container query hiding every label of a four- or five-step row below 35rem:
469
-
470
- ```text
471
- < 35rem + 4 steps or more markers only, unless a label is a link
472
- ```
473
-
474
- with `.sr-only` on `.step-label`, so the text stays in the accessibility tree
475
- while its box disappears. Or the same rules behind a public class, so the author
476
- picks the representation instead of a width picking it.
477
-
478
- A fixed hiding threshold cannot reflect the authored item floor or the actual
479
- length of a label. Wrapping uses the available share directly, without removing
480
- content or introducing a per-count breakpoint.
481
-
482
- ### Why the premise fails
483
-
484
- It asks the author to write five step names and then takes them away. Made
485
- explicit as a class, that is a public API whose entire meaning is *hide the
486
- content I just made you author* — plus a `.sr-only` clone in the component,
487
- plus a link guard so the hiding cannot clip a focus target, plus documentation
488
- explaining why four steps behave differently from three. The hidden markup ends
489
- up richer than the visible interface: a second, invisible version of the
490
- component.
491
-
492
- And the accessibility it buys is thinner than it looks. A CSS-numbered `<li>`
493
- sequence with five hidden names is not a better announcement than the sentence
494
- the page already contains. In practice the page says **Step 3 of 5 —
495
- Validation**, and the sequence is a picture of it.
496
-
497
- So the question is not "how narrow before labels must go?" but "does this
498
- sequence carry names at all?", and that one is the author's to answer in
499
- markup. An unlabelled sequence is compact because it has nothing to show; a
500
- labelled one keeps everything it was given. When a labelled row does not fit,
501
- the available answers are wrapping, scrolling, more space, or `.steps-vertical`.
502
-
503
- ### What the rule is worth, concretely
504
-
505
- Holding that line is what keeps all of the following out of the component:
506
-
507
- * a second container query, and the `< 35rem` threshold in it;
508
- * `:has(> :nth-child(4))`, and any other rule that counts steps;
509
- * `:not(:has(a[href]))` on a layout rule — a rule asking whether hiding would
510
- be safe;
511
- * a `.sr-only` clone inside the component, and `clip-path` anywhere in the file;
512
- * a marker-only variant class, and the `:not(...)` guard the wide query would
513
- need to leave it alone;
514
- * two of three `grid-template-rows` declarations and a `gap: 0`, since the base
515
- template need not build a label row for a step that has no label;
516
- * a browser test proving the focus guard reads structure rather than state, and
517
- the four- versus five-step threshold fixtures;
518
- * a documentation section explaining why three steps behave differently from
519
- four.
520
-
521
- It also generalises for free. Once "markers only" is *a step with no content*
522
- rather than *a representation of a labelled step*, the same sentence describes
523
- the column, and the contract is two independent dimensions rather than one
524
- orientation with a mode:
525
-
526
- ```text
527
- orientation x labels = four compositions, no variant classes
528
- ```
529
-
530
- ### The cheap versions of hiding, for the record
531
-
532
- Hiding a label is declarations, not a value, so it cannot ride on a custom
533
- property the way a `--step-min` override can. The tempting shortcuts each fail
534
- on their own terms: zero block-size and `font-size: 0` lose the accessible
535
- name, and style queries sit above the support floor.
536
-
537
- Relatedly, the wide block's declarations are written out rather than
538
- abstracted. One container query with an explicit body is easier to read, and to
539
- change, than any clever indirection.
540
-
541
- ## States
542
-
543
- Three states must be readable without a check glyph: future is neutral, complete
544
- is a filled marker, current is an outlined one with a thicker ring. Filled reads
545
- as "done", outlined as "you are here", and the distinction survives a numbered
546
- stepper that never sets `--step-complete-mark`.
547
-
548
- Current is declared after complete at equal specificity, so it wins on every
549
- channel — including the connector. The accented line means "already walked", so
550
- the segment *leaving* the current step is neutral; the segment *reaching* it is
551
- owned by the previous step, which is complete.
552
-
553
- The thicker ring is structural, so it survives forced colors, and it never
554
- competes with the outline channel that belongs to focus.
555
-
556
- ### Forced colors, and why there is no override
557
-
558
- Forced colors drops the accent fill, so in a numbered flow a complete marker and
559
- an upcoming one both render as a ringed disc with a number in it. Current still
560
- reads, on its thicker ring and its bolder label; complete and upcoming do not
561
- separate.
562
-
563
- The obvious remedy is a `@media (forced-colors: active)` block giving complete a
564
- system `Highlight` fill and `HighlightText` text. Captured with forced colors
565
- emulated through the DevTools protocol, that fill renders the marker's own
566
- content — the counter, or a `--step-complete-mark` checkmark — unreadable: a
567
- sliver of `HighlightText` inside a solid disc. It trades an ambiguity for an
568
- illegible glyph, in the exact mode it exists to help.
569
-
570
- So there is no such block, and the honest answer is documented instead:
571
- `--step-complete-mark` distinguishes the two states in forced colors as well as
572
- anywhere else, because a different glyph survives a colour system that flattens
573
- fills. An author whose flow needs that distinction sets it; the component does
574
- not fake it with a fill that cannot carry its own content.
575
-
576
- The general principle is the one this file keeps arriving at. A remedy that is
577
- worse than the problem in its own target mode is not a remedy, and shipping it
578
- "for accessibility" only makes the failure harder to notice.
579
-
580
- ## Connectors
581
-
582
- The connector pseudo-element is marker-height rather than hairline-height so
583
- `--step-connector` can be any complete background value — a gradient, an image,
584
- or `none`. The default paints the hairline as a gradient sized
585
- `100% var(--step-line-size)`.
586
-
587
- The colour rides inside that gradient as `var(--step-line)` rather than being a
588
- `--step-connector` default on `.steps`. A custom property resolves its `var()`
589
- before inheritance, so a parent-level default would freeze the parent's colour
590
- and a `.step-complete` child's connector would never follow its own state.
591
-
592
- `--step-inline-connector` exists because the inline representation gives the
593
- connector a genuinely different job: it absorbs the free space between
594
- marker + label groups, which is the region a theme replaces with a chevron. It
595
- falls back to `--step-connector`, then to the default line.
596
-
597
- There is deliberately no `--step-vertical-connector`. The vertical geometry is
598
- different, so a horizontal value cannot transpose onto it — but no real design
599
- has asked to repaint it, and `.steps-vertical > li::after` is a reachable
600
- override. Unrequested API is API not worth publishing.
601
-
602
- ## Scrolling on one axis
603
-
604
- The row scrolls horizontally as its last resort, and never vertically. Saying
605
- only `overflow-x: auto` does not express that: the spec computes the other axis
606
- to `auto` too whenever one axis is a scroll container, so `overflow-y` becomes
607
- `auto` by omission.
608
-
609
- That would be harmless if the row had any vertical slack, and it has none. A
610
- stacked step is a 28px marker, an 8px gap and a 17.5px label line — 53.5px, a
611
- fractional height the box hugs exactly. Whether `scrollHeight` rounds to the
612
- same integer as `clientHeight` then depends on the font in use, the device pixel
613
- ratio and the zoom level, so a phantom vertical scrollbar appears on one machine
614
- and not another — the shape of bug a fixed-width fixture cannot catch, which is
615
- why the browser test sweeps fractional widths instead of sampling a few.
616
-
617
- `overflow-y: hidden` settles it: there is genuinely nothing to scroll on that
618
- axis, in any representation.
619
-
620
- On the axis that does scroll, `overscroll-behavior-inline: contain` keeps a
621
- swipe that reaches the end of the row from chaining to the page behind it.
622
-
623
- The scrollbar itself is left to `.scroller`, composed on the row rather than
624
- baked into it. A stepper is short — a stacked step is 53.5px — so an OS-default
625
- scrollbar reads heavy under one, and the temptation is to give the component a
626
- `scrollbar-width: thin` of its own.
627
-
628
- The reason not to is consistency, not modularity. Every scroll container the
629
- framework owns — `.table`, `.flyout`, a scrolling `dialog`, `.app-layout`'s
630
- main — leaves the scrollbar to the engine. A stepper that thinned its own would
631
- be the only one, so a page with a scrolling table above a scrolling stepper
632
- would show two kinds of scrollbar. Scrollbar treatment is a decision an author
633
- makes once, for everything that scrolls, which is exactly the shape `.scroller`
634
- has: the scroller docs name this case — "pair it with `.overflow-auto` or a
635
- component that already creates overflow" — and `.nav-list scroller` is the same
636
- composition elsewhere.
637
-
638
- Baking the declarations without the hooks would also strand the author: the
639
- retuning surface is `--scroller-thumb` and `--scroller-track`, which belong to
640
- `.scroller`. Copying those into Steps duplicates the primitive; omitting them
641
- leaves a scrollbar no documented hook reaches.
642
-
643
- Measured on a five-step row with an authored `--step-min: 7rem` in a 380px region, the pairing takes the scrollbar
644
- from 15px to 10px and the row from 69px to 64px, with the thumb on
645
- `--text-muted` instead of the OS grey.
646
-
647
- Its `.stable-gutter` variant, on the other hand, is a trap worth naming.
648
- `scrollbar-gutter` reserves space on the *inline* axis, for a vertical
649
- scrollbar — and this row sets `overflow-y: hidden`, so there is never one to
650
- reserve for. It does not steady the row's height across the appearance of the
651
- horizontal scrollbar, which is what an author would reach for it to do:
652
- the reserved inline gutter narrows the row without reserving space for a
653
- horizontal scrollbar, making horizontal overflow more likely.
654
-
655
- What makes the row scroll rather than squash is the item floor:
656
- `min-inline-size: max(var(--step-size), var(--step-min))`. The `max()` is there
657
- so an author who lowers `--step-min` below `--step-size` cannot collapse items
658
- behind their own markers.
659
-
660
- The cost of scrolling is that clipping happens at the padding edge, and a focus
661
- ring is drawn outside its element's border box — the generic outline is
662
- `--focus-ring-width` wide at `--focus-outline-offset`, so 4px past a label that sits
663
- flush with the edge of a stacked row. A navigable row therefore reserves
664
- exactly that much `padding-block`, gated on `.steps-horizontal:has(a[href])`. An
665
- informational stepper — the common case, with no ring to protect — keeps its
666
- height, and so does a navigable column: the padding is compensation for the
667
- row's clip, and the column is not a scroll container at all.
668
-
669
- The two cheaper answers each cost something worse. Reserving the space
670
- unconditionally is one rule shorter and 8px taller on every stepper in the
671
- framework. Clipping, and letting focus scroll the ring into view, keeps the
672
- height and moves the row under the reader instead.
673
-
674
- ## Two compositions, one primitive
675
-
676
- `.steps` is the component. `.steps-horizontal` and `.steps-vertical` are peers,
677
- both required, neither the default. Vertical is an explicit orientation, never a
678
- responsive fallback, and it has no step-count limit: its practical limit is the
679
- surrounding layout rather than a row's width budget.
680
-
681
- `.steps` holds what a step *is*, under its own name. `.steps-horizontal` and
682
- `.steps-vertical` hold what is genuinely per-orientation. Nothing excludes
683
- anything, nothing undoes anything, and the rules read as what they are:
684
-
685
- ```text
686
- .steps what a step is
687
- .steps-horizontal a row, plus its container query
688
- .steps-vertical a column
689
- ```
690
-
691
- There is no third class, and no third *composition* either. A compact
692
- progression is the same `.steps-horizontal` with empty items, and a compact
693
- rail is the same `.steps-vertical` with empty items — which is why neither
694
- needs a name of its own. See "Why nothing hides a label".
695
-
696
- The cost is one class on the horizontal markup, where the orientation could be
697
- implicit. That is the right direction: if vertical is an explicit orientation
698
- rather than a fallback, horizontal being explicit too is the same claim stated
699
- once more.
700
-
701
- `.steps` on its own is incomplete markup. That is a real footgun — it renders a
702
- flex row of unpositioned markers rather than nothing — and it is the price of
703
- having neither orientation be the default. Documented, not defended.
704
-
705
- ### Why the primitive needs a class of its own
706
-
707
- Both alternatives cost more, and each in a way that is easy to mistake for
708
- economy.
709
-
710
- **Vertical as a modifier** — `.steps` meaning both the component and the
711
- horizontal layout — makes the column inherit a row and then undo it. Six
712
- declarations exist for no other reason:
713
-
714
- | Undone | Because the row sets |
715
- | --------------------------- | ----------------------------------------------- |
716
- | `overflow: visible` | `overflow-x: auto` |
717
- | `overscroll-behavior: auto` | `overscroll-behavior-inline: contain` |
718
- | `flex: none` | `flex: 1 0 var(--step-min)` |
719
- | `grid-template-rows: auto` | `grid-template-rows: var(--step-size)` |
720
- | `min-inline-size: 0` | `min-inline-size: max(--step-size, --step-min)` |
721
- | `text-align: start` | `text-align: center` |
722
-
723
- And it forces the inverse on the horizontal side: every rule that must not
724
- reach a column carries `:not(.steps-vertical)` — the focus-ring rule plus every
725
- rule in the container query.
726
-
727
- **Two independent roots** — `.steps` and `.steps-vertical` sharing no class —
728
- zeroes both of those lists. But then the shared half of the component (the
729
- counter, the marker, `.step-label`, `.step-complete`, `aria-current="step"`) has
730
- no name, and has to be spelled `:is(.steps, .steps-vertical)` on twelve rules.
731
- Twelve rules needing the same two-class prefix is what a shared primitive looks
732
- like when it has not been given a class of its own.
733
-
734
- ### `justify-items: start` is not a reset
735
-
736
- It looks like one, sitting in `.steps-vertical > li` next to properties the row
737
- also sets. It is the column's own alignment, and it is load-bearing: grid items
738
- blockify, so a label left at the default `normal` stretches across the whole
739
- `1fr` track — measured, an `a.step-label` goes from 75px to 264px. That is a
740
- full-width hover target and a full-width focus ring in a column, where the same
741
- link in a row gets a box that hugs its text.
742
-
743
- ### The connector's terminator
744
-
745
- The connector's geometry belongs to each composition, so only the question of
746
- *which* steps get one is shared. One rule states the condition:
747
- `.steps > li:not(:last-child)::after`. A pseudo-element with no content
748
- generates no box, so both compositions can address `> li::after` freely and
749
- neither can grow a line past the final step. Nothing to order, nothing to weigh.
750
-
751
- The alternative is two rules pulling against each other —
752
- `> li::after { content: "" }` and `> li:last-child::after { content: none }` —
753
- which makes "does a line trail the last step" a specificity question, and makes
754
- a stray `content` in a geometry rule enough to break it.
755
-
756
- Its row is aligned to `start` so a label that wraps begins level with the top of
757
- its marker. A single line is shorter than the marker and would float above its
758
- centre, so the label takes `align-self: center` — which only bites in that case,
759
- since a label tall enough to fill the row has nothing left to centre in.
760
- Measured, a single line sits 0.25px off the marker's cap-height centre with it,
761
- and 5px above without.
762
-
763
- ## Label typography
764
-
765
- The marker carries the state, so the label reads a notch below it: one size
766
- down, tight leading, neutral weight, with extra weight only on
767
- `aria-current="step"`. A completed step gets none — its filled disc already
768
- reads as strongly as text could.
769
-
770
- The size is set on the component, never inside a container block. A font-size
771
- that changed with the representation would resize the text under a reader
772
- dragging a window, on top of the layout move the threshold already makes.
773
-
774
- A navigable label keeps its underline, hover and focus ring but takes
775
- `color: inherit`, because `--link` is a theme hook and a link-coloured label
776
- would read ahead of the marker states it sits next to.