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.
Files changed (95) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +6 -6
  3. package/components.json +6 -3
  4. package/dist/actual.full.css +249 -50
  5. package/dist/actual.full.js +2 -2
  6. package/dist/actual.full.min.css +1 -1
  7. package/dist/types/menu.d.ts +2 -5
  8. package/docs/pages/components/accordion.md +11 -6
  9. package/docs/pages/components/alert.md +64 -62
  10. package/docs/pages/components/avatar.md +12 -12
  11. package/docs/pages/components/badge.md +15 -15
  12. package/docs/pages/components/breadcrumb.md +10 -8
  13. package/docs/pages/components/button.md +56 -7
  14. package/docs/pages/components/card.md +21 -21
  15. package/docs/pages/components/dialog.md +97 -69
  16. package/docs/pages/components/drawer.md +33 -33
  17. package/docs/pages/components/indicator.md +12 -12
  18. package/docs/pages/components/navbar.md +41 -9
  19. package/docs/pages/components/pagination.md +7 -7
  20. package/docs/pages/components/progress.md +18 -13
  21. package/docs/pages/components/rating.md +19 -19
  22. package/docs/pages/components/reveal.md +2 -0
  23. package/docs/pages/components/segmented.md +35 -31
  24. package/docs/pages/components/skeleton.md +10 -8
  25. package/docs/pages/components/spinner.md +21 -15
  26. package/docs/pages/components/table.md +26 -28
  27. package/docs/pages/enhancements/flyout.md +94 -43
  28. package/docs/pages/enhancements/in-view.md +3 -1
  29. package/docs/pages/enhancements/scrollspy.md +51 -18
  30. package/docs/pages/enhancements/tabs.md +43 -37
  31. package/docs/pages/enhancements/tooltip.md +4 -2
  32. package/docs/pages/forms/ajax.md +66 -0
  33. package/docs/pages/forms/choice-cards.md +8 -8
  34. package/docs/pages/forms/color-swatches.md +12 -12
  35. package/docs/pages/forms/form-actions.md +23 -0
  36. package/docs/pages/forms/joined-controls.md +8 -8
  37. package/docs/pages/forms/labels.md +11 -11
  38. package/docs/pages/forms/overview.md +35 -29
  39. package/docs/pages/forms/states-and-sizes.md +9 -9
  40. package/docs/pages/forms/switch.md +35 -2
  41. package/docs/pages/forms/validation.md +16 -16
  42. package/docs/pages/foundations/theming.md +32 -2
  43. package/docs/pages/foundations/tokens.md +18 -16
  44. package/docs/pages/guides/coding-agents.md +18 -0
  45. package/docs/pages/guides/introduction.md +1 -1
  46. package/llms.txt +3 -3
  47. package/package.json +5 -5
  48. package/reserved-classes.json +1 -0
  49. package/skills/actual-css/SKILL.md +7 -0
  50. package/src/cli/actual-css.js +3 -3
  51. package/src/css/components/badge.css +10 -6
  52. package/src/css/components/button.css +20 -7
  53. package/src/css/components/join.css +14 -4
  54. package/src/css/components/navbar.css +83 -1
  55. package/src/css/components/pagination.css +3 -1
  56. package/src/css/components/segmented.css +27 -7
  57. package/src/css/core/theme.css +11 -9
  58. package/src/css/core/tokens.css +7 -1
  59. package/src/css/core/variants.css +2 -0
  60. package/src/css/effects/reveal.css +15 -6
  61. package/src/css/forms/control.css +11 -1
  62. package/src/css/forms/form.css +14 -4
  63. package/src/css/forms/switch.css +32 -3
  64. package/src/js/ajax.js +18 -1
  65. package/src/js/context-menu.js +1 -3
  66. package/src/js/flyout.js +14 -5
  67. package/src/js/in-view.js +41 -30
  68. package/src/js/menu.js +9 -21
  69. package/src/js/surface.js +38 -0
  70. package/src/tooling/design-tokens.js +1 -0
  71. package/src/tooling/theme-contrast.js +24 -9
  72. package/tokens.json +1 -0
  73. package/docs/design-notes/accessibility-decisions.md +0 -63
  74. package/docs/design-notes/app-ui.md +0 -67
  75. package/docs/design-notes/architecture.md +0 -70
  76. package/docs/design-notes/browser-support.md +0 -239
  77. package/docs/design-notes/cascade-layer.md +0 -74
  78. package/docs/design-notes/column-layout.md +0 -260
  79. package/docs/design-notes/css-anchor.md +0 -87
  80. package/docs/design-notes/enhancement-contract.md +0 -193
  81. package/docs/design-notes/forced-colors.md +0 -123
  82. package/docs/design-notes/grid.md +0 -785
  83. package/docs/design-notes/motion-cost.md +0 -62
  84. package/docs/design-notes/naming.md +0 -71
  85. package/docs/design-notes/platform-alignment.md +0 -602
  86. package/docs/design-notes/popover-manual-poc.md +0 -328
  87. package/docs/design-notes/references.md +0 -336
  88. package/docs/design-notes/rich-text.md +0 -61
  89. package/docs/design-notes/spacing-units.md +0 -286
  90. package/docs/design-notes/steps.md +0 -776
  91. package/docs/design-notes/surface-reparenting.md +0 -130
  92. package/docs/design-notes/tokens.md +0 -166
  93. package/docs/design-notes/tooltip-coordinate-space.md +0 -130
  94. package/docs/design-notes/widget-primitives.md +0 -144
  95. package/docs/navigation.json +0 -176
@@ -2,7 +2,9 @@
2
2
 
3
3
  > Placeholder shapes for content that is loading.
4
4
 
5
- - Use `.skeleton` for loading placeholders.
5
+ - Use `.skeleton` to reserve space for content with a predictable layout. Use
6
+ a [spinner](spinner.md) to signal a pending action with no content
7
+ placeholder.
6
8
  - Use `data-shape` for common placeholder forms: `text`, `title`, `avatar`, `box`.
7
9
  - Put `role="status"` and accessible text on the loading region, not on every placeholder.
8
10
  - Use layout utilities for placeholder arrangement.
@@ -11,13 +13,6 @@
11
13
  **Related terms:** skeleton screen, shimmer, loading placeholder. For a text
12
14
  label showing an activity in progress, see [Shimmer](shimmer.md).
13
15
 
14
- ## Class reference
15
-
16
- | Class | Kind | Description |
17
- | ------------ | --------- | --------------------------------------------------- |
18
- | `.skeleton` | Component | Animated placeholder shape. |
19
- | `data-shape` | Modifier | Geometry presets: `text`, `title`, `avatar`, `box`. |
20
-
21
16
  ## Basic usage
22
17
 
23
18
  ```html demo
@@ -32,6 +27,13 @@ label showing an activity in progress, see [Shimmer](shimmer.md).
32
27
  </article>
33
28
  ```
34
29
 
30
+ ## Class reference
31
+
32
+ | Class | Kind | Description |
33
+ | ------------ | --------- | --------------------------------------------------- |
34
+ | `.skeleton` | Component | Animated placeholder shape. |
35
+ | `data-shape` | Modifier | Geometry presets: `text`, `title`, `avatar`, `box`. |
36
+
35
37
  ## CSS hooks
36
38
 
37
39
  - `--skeleton-track` — base placeholder color.
@@ -2,26 +2,18 @@
2
2
 
3
3
  > Loading indicator for actions or regions that may take noticeable time.
4
4
 
5
- - Most actions do not need a spinner. Use `disabled` alone for fast actions or to prevent duplicate submissions.
5
+ - Use a spinner for a pending action with no measurable progress. Put it on the
6
+ [button](button.md#loading) for a local action, or overlay an existing region
7
+ that is being updated.
8
+ - Use a [skeleton](skeleton.md) when the incoming content has a predictable
9
+ shape, or a [progress bar](progress.md) when the amount of work completed
10
+ can be measured.
6
11
  - Use `aria-busy="true"` with a loading label for actions that are visibly in progress.
7
- - Add `.spinner` only when the operation may take long enough that users need explicit loading feedback.
8
12
  - The spinner uses `currentColor`, so it adapts to its context.
9
13
  - Decorative spinners should be `aria-hidden="true"`.
10
14
  - Use `role="status"` with accessible text when the loading state needs to be announced.
11
15
  - Put a direct last-child `.spinner` inside a busy region to show a centered loading overlay. In buttons, spinners remain inline.
12
16
 
13
- ## Class reference
14
-
15
- | Class | Kind | Description |
16
- | -------------------- | --------- | ------------------------------------------------ |
17
- | `.spinner` | Component | Circular loading indicator using `currentColor`. |
18
- | `[aria-busy="true"]` | State | Loading region; see Busy state below. |
19
- | `.sm` / `.lg` | Size | Smaller (`0.75em`) or larger (`2rem`) spinner. |
20
- | Shared intents | Intent | `.primary`, `.secondary`, `.success`, … |
21
-
22
- The shared intents are `.primary`, `.secondary`, `.success`, `.warning` and
23
- `.danger`.
24
-
25
17
  ## Basic usage
26
18
 
27
19
  ```html demo
@@ -70,6 +62,18 @@ Announce the loading state when it needs to be spoken.
70
62
 
71
63
  Size follows the font (`1em`); use `.sm` / `.lg` rather than sizing it directly.
72
64
 
65
+ ## Class reference
66
+
67
+ | Class | Kind | Description |
68
+ | -------------------- | --------- | ------------------------------------------------ |
69
+ | `.spinner` | Component | Circular loading indicator using `currentColor`. |
70
+ | `[aria-busy="true"]` | State | Loading region; see Busy state below. |
71
+ | `.sm` / `.lg` | Size | Smaller (`0.75em`) or larger (`2rem`) spinner. |
72
+ | Shared intents | Intent | `.primary`, `.secondary`, `.success`, … |
73
+
74
+ The shared intents are `.primary`, `.secondary`, `.success`, `.warning` and
75
+ `.danger`.
76
+
73
77
  ## Busy state
74
78
 
75
79
  The spinner is the indicator; `aria-busy` is the state. A container-wide
@@ -80,7 +84,9 @@ surface; buttons keep their spinners inline instead (see Button).
80
84
 
81
85
  - Set `aria-busy="true"` on the container and add `<span class="spinner" aria-hidden="true"></span>` as its last direct child.
82
86
  - The overlay uses `--busy-overlay-bg`; a card derives it from its own surface.
83
- - Decorative spinners stay `aria-hidden="true"`; announce progress on the region with `role="status"` and a label when needed.
87
+ - When an announcement is needed before the region finishes updating, put a
88
+ separate `role="status"` outside the busy region. Assistive technology can
89
+ defer announcements inside an `aria-busy="true"` subtree.
84
90
 
85
91
  ```html demo
86
92
  <article class="card" aria-busy="true" aria-label="Loading card content">
@@ -2,24 +2,6 @@
2
2
 
3
3
  > Data table with caption and scope attributes, and an accessible scroll region for wide content.
4
4
 
5
- - Use native `<table class="table">` inside a `.table-wrap` for surface, border, radius, and overflow.
6
- - Use `<caption>`, `scope="col"`, and `scope="row"` for accessibility.
7
- - Use `.text-end` for numeric columns and `.text-nowrap` for non-wrapping cells.
8
- - For wide tables, make the wrapper an accessible scroll region with `role="region"`, `aria-labelledby`, and `tabindex="0"`.
9
- - Tables stay content-first and neutral by default.
10
- - `.table` is a static, content-first table. It provides no sorting, filtering, search, selection, pagination, or row actions. For an interactive data grid ("datatable"), use a dedicated component — see the [data grid template](../../demo/templates/data-grid.html), which themes `data-grid-component` with Actual CSS tokens.
11
- - `.table` does not consume shared variants or intent colors (`--ui-bg` / `--intent`): a `.soft` + intent combo on a `<tr>` has no effect. To tint rows or headers, style them with a class of your own.
12
-
13
- ## Class reference
14
-
15
- | Class | Kind | Description |
16
- | ---------------- | --------- | ------------------------------------------------------------ |
17
- | `.table-wrap` | Component | Scroll container and outer chrome (surface, border, radius). |
18
- | `.table` | Component | The table itself; row and cell rules. |
19
- | `.table.compact` | Density | Tighter cell padding; font size and icons unchanged. |
20
-
21
- ## Basic usage
22
-
23
5
  ```html demo
24
6
  <div class="table-wrap">
25
7
  <table class="table">
@@ -56,6 +38,29 @@
56
38
  </div>
57
39
  ```
58
40
 
41
+ ## Usage
42
+
43
+ - Use a table when readers need to compare the same fields across records.
44
+ Use a [list](list.md) when each record is read on its own, or a
45
+ [data list](data-list.md) for one record's label–value pairs.
46
+ - For built-in sorting, filtering or row selection, see the themed
47
+ [data grid template](../../demo/templates/data-grid.html). For
48
+ server-rendered pages of results, pair the table with
49
+ [pagination](pagination.md).
50
+ - Give the table a caption that identifies the dataset. Use `scope="col"`
51
+ on column headers and `scope="row"` on cells that identify their row.
52
+ Put units in column headers when they apply to every value in the column.
53
+ - Use `.text-end` for numeric columns and `.text-nowrap` for values that
54
+ should stay together. Use an application class to tint a row or header.
55
+
56
+ ## Class reference
57
+
58
+ | Class | Kind | Description |
59
+ | ---------------- | --------- | ------------------------------------------------------------ |
60
+ | `.table-wrap` | Component | Scroll container and outer chrome (surface, border, radius). |
61
+ | `.table` | Component | The table itself; row and cell rules. |
62
+ | `.table.compact` | Density | Tighter cell padding; font size and icons unchanged. |
63
+
59
64
  ## Accessible scroll region
60
65
 
61
66
  For wide tables, add `role="region"`, `aria-labelledby`, and `tabindex="0"` to
@@ -203,16 +208,9 @@ positioning keep the core hover.
203
208
 
204
209
  ## When a table stops reading as a table
205
210
 
206
- Responsive strategy is horizontal overflow: the wrap scrolls, the table keeps
207
- its columns and its column scanability. No `data-label` restructuring, no
208
- second representation of the data.
209
-
210
- For datasets that no longer read well as a table on narrow screens, compose a
211
- different view instead of restructuring the table: a `.list` / `.media` row
212
- with badges and actions for a CRUD collection, [`.data-list`](data-list.md)
213
- for one object's properties, or a dedicated data grid for interactive tables
214
- (sorting, filtering, selection). Two views for two contexts is a feature, not
215
- a duplication.
211
+ Keep the columns and let the wrapper scroll when readers still need to
212
+ compare values on a narrow screen. When the main task is opening or acting
213
+ on one record at a time, use a [list with row actions](list.md).
216
214
 
217
215
  ## CSS hooks
218
216
 
@@ -4,25 +4,29 @@
4
4
 
5
5
  **Related terms:** popover, dropdown, dropdown menu, action menu, context menu, bottom sheet, action sheet, anchored panel, filter panel, sticky footer, apply button.
6
6
 
7
- ## Class reference
8
-
9
- | Class | Kind | Description |
10
- | ----------------- | ----------- | ---------------------------------------------- |
11
- | `.flyout-trigger` | Composition | Positioning wrapper for trigger and panel. |
12
- | `.stretch` | Modifier | Spans a `.flyout-trigger` to its container. |
13
- | `.flyout` | Component | Floating surface, positioned by JavaScript. |
14
- | `.scrollable` | Modifier | Header and footer stay while the body scrolls. |
15
- | `.menu` | Component | Action-list primitive. |
16
- | `.menu-item` | Component | One action row; joins roving focus. |
17
- | `.menu-item-icon` | Slot | Fixed leading column for an icon. |
18
- | `.menu-item-text` | Slot | Flexible label column; truncates. |
19
- | `.menu-item-end` | Slot | Trailing shortcut, badge or status. |
20
- | `.menu-label` | Variant | Muted, non-interactive group heading. |
21
- | `.menu-separator` | Variant | Divider row between groups. |
22
- | `.sm` / `.lg` | Size | Smaller or larger menu rows and type. |
7
+ ```html demo
8
+ <div class="flyout-trigger">
9
+ <button class="btn outline"
10
+ type="button"
11
+ data-enhance="flyout"
12
+ aria-expanded="false"
13
+ aria-controls="account-actions"
14
+ id="account-flyout-trigger">
15
+ Account
16
+ <i class="ti ti-chevron-down" aria-hidden="true"></i>
17
+ </button>
23
18
 
24
- Action rows use `.menu > li > .menu-item`. Labels and dividers use their own
25
- `<li>` rows.
19
+ <menu class="flyout sm menu"
20
+ id="account-actions"
21
+ aria-labelledby="account-flyout-trigger"
22
+ hidden>
23
+ <li><button class="menu-item" type="button">Profile</button></li>
24
+ <li><button class="menu-item" type="button">Settings</button></li>
25
+ <li class="menu-separator" aria-hidden="true"></li>
26
+ <li><button class="menu-item danger" type="button">Sign out</button></li>
27
+ </menu>
28
+ </div>
29
+ ```
26
30
 
27
31
  ## Usage
28
32
 
@@ -183,6 +187,11 @@ flyout when that specific control must close it regardless of the automatic
183
187
  policy. This is useful for an Apply or Done action in an `outside` or `false`
184
188
  panel. The trigger and Escape continue to close the flyout in every mode.
185
189
 
190
+ Focus that moves outside the flyout and its triggers, by Tab, Shift+Tab or a
191
+ script, closes it and stays where it landed; Escape is the key that returns
192
+ focus to the trigger. `false` keeps the flyout open there too, so a persistent
193
+ panel must not cover the controls around it.
194
+
186
195
  Arrow keys and Space in a radio group never close the flyout: they move
187
196
  through the options, and a pointer pick closes it. Opening from the keyboard
188
197
  focuses a group at its checked radio. The [palette picker](../forms/color-swatches.md#palette-in-a-flyout)
@@ -198,6 +207,26 @@ relies on both.
198
207
  </div>
199
208
  ```
200
209
 
210
+ ## Class reference
211
+
212
+ | Class | Kind | Description |
213
+ | ----------------- | ----------- | ---------------------------------------------- |
214
+ | `.flyout-trigger` | Composition | Positioning wrapper for trigger and panel. |
215
+ | `.stretch` | Modifier | Spans a `.flyout-trigger` to its container. |
216
+ | `.flyout` | Component | Floating surface, positioned by JavaScript. |
217
+ | `.scrollable` | Modifier | Header and footer stay while the body scrolls. |
218
+ | `.menu` | Component | Action-list primitive. |
219
+ | `.menu-item` | Component | One action row; joins roving focus. |
220
+ | `.menu-item-icon` | Slot | Fixed leading column for an icon. |
221
+ | `.menu-item-text` | Slot | Flexible label column; truncates. |
222
+ | `.menu-item-end` | Slot | Trailing shortcut, badge or status. |
223
+ | `.menu-label` | Variant | Muted, non-interactive group heading. |
224
+ | `.menu-separator` | Variant | Divider row between groups. |
225
+ | `.sm` / `.lg` | Size | Smaller or larger menu rows and type. |
226
+
227
+ Action rows use `.menu > li > .menu-item`. Labels and dividers use their own
228
+ `<li>` rows.
229
+
201
230
  Flyout covers two distinct patterns, detected by the `<menu>` element or
202
231
  `.menu` class on the panel:
203
232
 
@@ -212,30 +241,7 @@ A list of *actions* the user can take: sign out, copy, delete.
212
241
  - Items are regular `<button>` or `<a>` elements.
213
242
  - Use `.sm` or `.lg` to scale one flyout; use a density context for surrounding UI.
214
243
  - Add `role="menu"` / `role="menuitem"` only when you intentionally need the ARIA menu pattern described below.
215
-
216
- ```html demo
217
- <div class="flyout-trigger">
218
- <button class="btn outline"
219
- type="button"
220
- data-enhance="flyout"
221
- aria-expanded="false"
222
- aria-controls="account-actions"
223
- id="account-flyout-trigger">
224
- Account
225
- <i class="ti ti-chevron-down" aria-hidden="true"></i>
226
- </button>
227
-
228
- <menu class="flyout sm menu"
229
- id="account-actions"
230
- aria-labelledby="account-flyout-trigger"
231
- hidden>
232
- <li><button class="menu-item" type="button">Profile</button></li>
233
- <li><button class="menu-item" type="button">Settings</button></li>
234
- <li class="menu-separator" aria-hidden="true"></li>
235
- <li><button class="menu-item danger" type="button">Sign out</button></li>
236
- </menu>
237
- </div>
238
- ```
244
+ - The account menu at the top of this page is a plain action list.
239
245
 
240
246
  ### ARIA menu pattern
241
247
 
@@ -342,7 +348,7 @@ can be multi-column with `<section>` / `<ul>` groups.
342
348
 
343
349
  - Items are regular `<a href>` links, not `role="menuitem"`.
344
350
  - No roving focus — ArrowDown/Enter open the panel and focus the first focusable descendant. Tab from an open trigger also enters the panel. There is no arrow-key navigation between items inside.
345
- - Just a toggle with outside-click and Escape dismissal.
351
+ - Just a toggle with outside-click, focus-leave and Escape dismissal.
346
352
  - Use grid utilities, such as `.grid-3`, for wider multi-column flyouts.
347
353
 
348
354
  ```html demo
@@ -519,6 +525,51 @@ form.addEventListener("submit", async (event) => {
519
525
  });
520
526
  ```
521
527
 
528
+ ## Contextual help
529
+
530
+ **Related terms:** toggletip, help icon, info popover, more information.
531
+
532
+ Help that needs a link, or more than a short phrase, goes in a flyout opened
533
+ by a small button beside the label, not in a [tooltip](tooltip.md). The panel
534
+ is a plain `<div>`: Enter, Space or Arrow Down open it and focus its link,
535
+ and Escape closes it and returns focus to the button.
536
+
537
+ ```html demo
538
+ <div class="field">
539
+ <div class="cluster" style="--gap: var(--space-10)">
540
+ <label class="field-label" for="billing-id">Billing ID</label>
541
+ <div class="flyout-trigger">
542
+ <button class="btn ghost sm icon-only"
543
+ type="button"
544
+ data-enhance="flyout"
545
+ aria-expanded="false"
546
+ aria-controls="billing-id-help"
547
+ aria-label="About the billing ID">
548
+ <i class="ti ti-help-circle" aria-hidden="true"></i>
549
+ </button>
550
+ <div class="flyout"
551
+ id="billing-id-help"
552
+ data-flyout-auto-close="outside"
553
+ style="--flyout-pad: var(--space-30); --flyout-max-inline-size: 16rem"
554
+ hidden>
555
+ <div class="stack" style="--gap: var(--space-20)">
556
+ <p>The reference printed at the top of each invoice, such as <code>INV2041</code>.</p>
557
+ <a href="#">Where to find it</a>
558
+ </div>
559
+ </div>
560
+ </div>
561
+ </div>
562
+ <input class="input" id="billing-id" name="billing-id" />
563
+ </div>
564
+ ```
565
+
566
+ - Name the button after its topic, such as "About the billing ID", not "Help".
567
+ - Keep instructions everyone needs in a visible `.field-help`; the panel holds
568
+ the optional explanation.
569
+ - The panel closes when focus moves on to the field, on Escape, or on a click
570
+ outside, so it never hides the control that takes focus next.
571
+ - The `.stack` drops the paragraph margins inside the panel.
572
+
522
573
  ## Context menu
523
574
 
524
575
  Context menus use the same `.menu > li > .menu-item` presentation primitive as
@@ -102,7 +102,9 @@ a surrounding section has generous leading padding.
102
102
 
103
103
  Pending content remains in the accessibility tree and tab order. When focus
104
104
  enters it, the runtime releases it immediately and finishes the entrance so
105
- the focused control is visible without waiting for motion.
105
+ the focused control is visible without waiting for motion. The same applies
106
+ while an entrance is still running or delayed after its release, including the
107
+ first-render entrance of content visible at load.
106
108
 
107
109
  Without JavaScript or `IntersectionObserver`, nothing becomes pending:
108
110
  Reveal plays on first render and Mark sweep shows its full highlight.
@@ -6,24 +6,6 @@ Scrollspy is a behavior hook, not a visual component. It marks a navigation
6
6
  region for the JavaScript enhancement. Pair it with `.nav-list` and `.nav-link`,
7
7
  or style `[aria-current="location"]` yourself.
8
8
 
9
- ## Class reference
10
-
11
- | Class | Kind | Description |
12
- | ------------ | ----------- | ------------------------------------------------------------- |
13
- | `.scrollspy` | Component | Marks the nav region for the enhancer; adds no visual styles. |
14
- | `.nav-list` | Composition | Vertical list of navigation links. |
15
- | `.nav-link` | Component | Navigation link, current on `aria-current="location"`. |
16
-
17
- ## Usage
18
-
19
- - `.scrollspy` marks the region for JS detection. It does not add visual styles.
20
- - `.nav-list` and `.nav-link` provide the visible list and active link styling.
21
- - The JS enhancer toggles `aria-current="location"` on the active link. Without JavaScript, the links remain regular anchor links.
22
- - The active section is the last heading past the activation line. Over the final viewport of scroll travel, the line advances to the bottom so short trailing sections become active in order. Above the first section, no link is active.
23
- - `data-scrollspy-root="#container"` measures a scroll container instead of the viewport.
24
- - `data-scrollspy-offset` moves the activation line: a bare number or `px` value is pixels, a `%` value is a share of the root's visible height. Invalid values fall back to `20%`, and negatives clamp to `0`.
25
- - The same markup also works with the CSS-native scroll markers path (see below).
26
-
27
9
  ```html demo
28
10
  <nav class="scrollspy" data-enhance="scrollspy" aria-label="Page sections">
29
11
  <ol class="nav-list">
@@ -48,6 +30,57 @@ or style `[aria-current="location"]` yourself.
48
30
  </main>
49
31
  ```
50
32
 
33
+ ## Usage
34
+
35
+ - `.scrollspy` marks the region for JS detection. It does not add visual styles.
36
+ - `.nav-list` and `.nav-link` provide the visible list and active link styling.
37
+ - The JS enhancer toggles `aria-current="location"` on the active link. Without JavaScript, the links remain regular anchor links.
38
+ - The active section is the last heading past the activation line. Over the final viewport of scroll travel, the line advances to the bottom so short trailing sections become active in order. Above the first section, no link is active.
39
+ - `data-scrollspy-root="#container"` measures a scroll container instead of the viewport.
40
+ - `data-scrollspy-offset` moves the activation line: a bare number or `px` value is pixels, a `%` value is a share of the root's visible height. Invalid values fall back to `20%`, and negatives clamp to `0`.
41
+ - The same markup also works with the CSS-native scroll markers path (see below).
42
+ - Add `.rail` to the `.nav-list` for a table of contents: the current band
43
+ slides along the rail as the page scrolls, while keyboard focus stays free.
44
+
45
+ ## Class reference
46
+
47
+ | Class | Kind | Description |
48
+ | ------------ | ----------- | ------------------------------------------------------------- |
49
+ | `.scrollspy` | Component | Marks the nav region for the enhancer; adds no visual styles. |
50
+ | `.nav-list` | Composition | Vertical list of navigation links. |
51
+ | `.nav-link` | Component | Navigation link, current on `aria-current="location"`. |
52
+
53
+ ## Table of contents on a rail
54
+
55
+ A scroll container keeps the demo self-contained: the band follows the
56
+ section at the top of the panel.
57
+
58
+ ```html demo
59
+ <div class="sidebar-layout">
60
+ <div class="overflow-auto scroller" id="rail-demo-panel" style="max-block-size: 14rem">
61
+ <section id="rail-install" tabindex="-1" style="min-block-size: 10rem">
62
+ <h3>Install</h3>
63
+ <p>Add the stylesheet, then the enhancer.</p>
64
+ </section>
65
+ <section id="rail-theme" tabindex="-1" style="min-block-size: 10rem">
66
+ <h3>Theme</h3>
67
+ <p>Replace the palette on <code>:root</code>.</p>
68
+ </section>
69
+ <section id="rail-ship" tabindex="-1" style="min-block-size: 10rem">
70
+ <h3>Ship</h3>
71
+ <p>Pin the version in your CDN link.</p>
72
+ </section>
73
+ </div>
74
+ <nav class="scrollspy" data-enhance="scrollspy" data-scrollspy-root="#rail-demo-panel" aria-label="Steps">
75
+ <ol class="nav-list rail">
76
+ <li><a class="nav-link" href="#rail-install" aria-current="location">Install</a></li>
77
+ <li><a class="nav-link" href="#rail-theme">Theme</a></li>
78
+ <li><a class="nav-link" href="#rail-ship">Ship</a></li>
79
+ </ol>
80
+ </nav>
81
+ </div>
82
+ ```
83
+
51
84
  ## Native scroll markers
52
85
 
53
86
  Modern browsers are starting to support CSS-native scroll markers with
@@ -2,43 +2,6 @@
2
2
 
3
3
  > In-place panel switcher using real tab semantics, with roving tabindex and arrow-key navigation.
4
4
 
5
- ## Class reference
6
-
7
- | Class | Kind | Description |
8
- | ---------------- | --------- | -------------------------------------------- |
9
- | `.tabs` | Component | Tab strip; pairs with `role="tablist"`. |
10
- | `.tab` | Component | One tab trigger; pairs with `role="tab"`. |
11
- | `.primary` | Intent | Tints the selected tab's indicator and text. |
12
- | `.tabs-attached` | Component | Joins a horizontal tablist to its panels. |
13
- | `.tab-panel` | Part | Framed panel inside `.tabs-attached`. |
14
-
15
- ## Usage
16
-
17
- - Use real tab semantics when panels switch in place.
18
- - Use normal links and `aria-current="page"` for page navigation that only looks like tabs.
19
- - On that link variant, `aria-current="page"` gets the same color and
20
- underline treatment as `aria-selected="true"` on a widget tab; `primary`
21
- tints it. A flyout trigger takes `"true"` (see below); any other value is
22
- inert.
23
- - Tab selection never changes text metrics: the active tab keeps the shared
24
- weight and is marked by color and the indicator line.
25
- - JavaScript owns roving `tabindex`, `aria-selected`, `hidden`, and keyboard behavior.
26
- - Left/Right select tabs and wrap at the ends. Home/End jump to first/last. Down moves focus into the selected panel.
27
- - A tab list needs both `.tabs` and `role="tablist"`; `.tab` styles each trigger.
28
- A tab belongs to its closest `role="tablist"`. `data-enhance="tabs"` on an
29
- element without that role wires nothing and warns in the console.
30
- - Import `actual-css/js/tab` to register the `data-enhance="tabs"` behavior.
31
- - A `.tab` with an icon uses `--tab-gap` (default `0.375em`) for the space between icon and label.
32
- - A tab that is `hidden`, `disabled`, `aria-disabled`, or has no panel is skipped
33
- by the arrow keys. An application filtering a tab strip only has to set
34
- `hidden`; deciding what to show when the selected tab is filtered out is the
35
- application's call.
36
- - `actual:tab-change` bubbles from the tablist after the user selects another
37
- tab, with `{ tab, panel, previousTab }`. It cannot be canceled and does not
38
- fire at connect: read `aria-selected` for the initial tab. Use it to sync
39
- content outside the panels, such as a summary card that follows the selected
40
- tab.
41
-
42
5
  ```html demo
43
6
  <div class="tabs" data-enhance="tabs" role="tablist" aria-label="Settings">
44
7
  <button class="tab primary"
@@ -80,6 +43,49 @@
80
43
  </section>
81
44
  ```
82
45
 
46
+ ## Usage
47
+
48
+ - Use tabs for distinct sections that switch in place. For a compact choice
49
+ among views of the same content, see [segmented control](../components/segmented.md).
50
+ - Use normal links and `aria-current="page"` for page navigation that only looks like tabs.
51
+ - On that link variant, `aria-current="page"` gets the same color and
52
+ underline treatment as `aria-selected="true"` on a widget tab; `primary`
53
+ tints it. A flyout trigger takes `"true"` (see below); any other value is
54
+ inert.
55
+ - Tab selection never changes text metrics: the active tab keeps the shared
56
+ weight and is marked by color and the indicator line.
57
+ - JavaScript owns roving `tabindex`, `aria-selected`, `hidden`, and keyboard behavior.
58
+ - In a horizontal tablist, Left/Right select tabs and Down moves focus into
59
+ the selected panel. For a vertical strip, set `aria-orientation="vertical"`
60
+ on the tablist. Up/Down then select tabs. Both orientations wrap at the
61
+ ends and support Home/End.
62
+ - A tab list needs both `.tabs` and `role="tablist"`; `.tab` styles each trigger.
63
+ A tab belongs to its closest `role="tablist"`. `data-enhance="tabs"` on an
64
+ element without that role wires nothing and warns in the console.
65
+ - Import `actual-css/js/tab` to register the `data-enhance="tabs"` behavior.
66
+ - A `.tab` with an icon uses `--tab-gap` (default `0.375em`) for the space between icon and label.
67
+ - A tab that is `hidden`, `disabled`, `aria-disabled`, or has no panel is skipped
68
+ by the arrow keys. An application filtering a tab strip only has to set
69
+ `hidden`; deciding what to show when the selected tab is filtered out is the
70
+ application's call.
71
+ - `actual:tab-change` bubbles from the tablist after the user selects another
72
+ tab, with `{ tab, panel, previousTab }`. It cannot be canceled and does not
73
+ fire at connect: read `aria-selected` for the initial tab. Use it to sync
74
+ content outside the panels, such as a summary card that follows the selected
75
+ tab.
76
+
77
+ ## Class reference
78
+
79
+ | Class | Kind | Description |
80
+ | ---------------- | --------- | -------------------------------------------- |
81
+ | `.tabs` | Component | Tab strip; pairs with `role="tablist"`. |
82
+ | `.tab` | Component | One tab trigger; pairs with `role="tab"`. |
83
+ | `.primary` | Intent | Tints the selected tab's indicator and text. |
84
+ | `.tabs-attached` | Component | Joins a horizontal tablist to its panels. |
85
+ | `.tab-panel` | Part | Framed panel inside `.tabs-attached`. |
86
+
87
+ ## Navigation tabs
88
+
83
89
  For navigation that only looks like tabs, keep it a plain link list — no
84
90
  JavaScript involved:
85
91
 
@@ -10,14 +10,16 @@ by promoting it to the top layer with `popover="manual"`.
10
10
  - Use `data-tooltip` on the trigger. With text (`data-tooltip="Help"`), the tooltip element is generated. Empty (`data-tooltip`) marks an explicit tooltip connected via `aria-describedby`.
11
11
  - Generated text is a snapshot at show time: changing `data-tooltip` never rewrites a tooltip that is already shown, and an always-visible generated tooltip keeps its initial text. For content that must update dynamically, use an explicit tooltip. See the [tooltips bench](../examples/overview.md) (`demo/templates/tooltips.html`) for all six cases side by side.
12
12
  - Generated text is always plain text (`textContent` only), so a shorthand value is safe for untrusted strings once they are in the DOM. An explicit tooltip is author-owned DOM: its sanitization belongs to whoever produces it. Escape the attribute server-side — a DOM already compromised at render cannot be repaired at read time. There is no `data-tooltip-html`, by design.
13
- - Tooltips are supplemental. Do not put required information or interactive controls inside them.
13
+ - Keep essential instructions and control names available without opening a
14
+ tooltip. Use a [flyout](flyout.md#contextual-help) for contextual help with
15
+ links or buttons.
14
16
  - Show on hover and keyboard focus. Hide on Escape, blur, pointer leave, or a pointer press on the trigger.
15
17
  - A trigger scrolled out of view takes its tooltip down and brings it back when it returns; only a dismissal ends the tooltip.
16
18
  - Escape dismisses the tooltip without moving the pointer or focus (WCAG 2.1 SC 1.4.13).
17
19
  - After Escape or a pointer press dismisses a hover or focus tooltip, move the pointer away and back or return with keyboard focus to show it again.
18
20
  - Author an explicit tooltip with `hidden`. The runtime removes it when it takes the lifecycle over; until then it is what keeps the tooltip off screen.
19
21
  - JavaScript can generate tooltip elements from `data-tooltip`.
20
- - Add `data-tooltip-click` to toggle it on click instead of hover/focus.
22
+ - Add `data-tooltip-click` to make a supplemental description open on click.
21
23
  - Add `data-tooltip-visible` to show it immediately and keep it visible while its trigger is in view.
22
24
  - Use `data-tooltip-placement` to set the preferred placement (default `top`).
23
25
  - The arrow inherits the tooltip background — custom gradients carry through automatically.
@@ -62,6 +62,11 @@ field; when the server issues a new token per submission, re-render the form
62
62
  with the answer, or the next submission sends a spent token. A redirect, such as post/redirect/get, navigates the
63
63
  page; `fetch` has already followed it, so the destination loads twice.
64
64
 
65
+ When the update removes the focused element, such as the submit button of a
66
+ re-rendered form, focus moves to the answer's first `aria-invalid="true"`
67
+ field, or else to an element marked `autofocus`, or else to the target if it
68
+ has a `tabindex`. Focus outside the target is left alone.
69
+
65
70
  Every response reaches `actual:ajax-response` with
66
71
  `{ form, submitter, response }`, after the target update or before a redirect
67
72
  navigates; check `response.ok`. A network failure reaches `actual:ajax-error`
@@ -75,6 +80,67 @@ document.addEventListener("actual:ajax-response", ({ detail }) => {
75
80
  });
76
81
  ```
77
82
 
83
+ ## Confirm, show errors, recover
84
+
85
+ **Related terms:** inline loading, submit feedback, success message, server
86
+ errors, retry.
87
+
88
+ The target wraps the form, so the server answers every outcome it handles with
89
+ HTML. A failure region sits outside the target and exists before it is filled,
90
+ so assistive technology announces it.
91
+
92
+ ```html
93
+ <div id="contact">
94
+ <form class="stack" id="contact-form" action="/contact" method="post"
95
+ data-enhance="validation ajax" data-ajax-target="#contact">
96
+ <label class="field">
97
+ <span class="field-label">Email</span>
98
+ <input class="input" type="email" name="email" required
99
+ aria-describedby="contact-email-error" />
100
+ <span class="field-error" id="contact-email-error"></span>
101
+ </label>
102
+ <div class="cluster form-actions">
103
+ <button class="btn primary" type="submit" aria-busy="false">
104
+ Send <span class="spinner" aria-hidden="true"></span>
105
+ </button>
106
+ </div>
107
+ </form>
108
+ </div>
109
+ <div id="contact-failure" role="alert"></div>
110
+ ```
111
+
112
+ - **Sending:** the button shows its spinner and further clicks send nothing.
113
+ `aria-busy="false"` keeps the spinner hidden at rest.
114
+ - **Sent:** answer `200` with the confirmation. Mark it `autofocus` with
115
+ `tabindex="-1"`, so focus lands on it and it is read:
116
+ `<div class="alert success" tabindex="-1" autofocus>Message sent.</div>`.
117
+ - **Rejected:** answer `422` with the same form, the field marked
118
+ `aria-invalid="true"` and its `.field-error` filled. Focus lands on that
119
+ field, which reads its error. Keep the values the user typed.
120
+ - **Failed:** a network error or another status leaves the form as it was.
121
+ The application fills the failure region:
122
+
123
+ ```js
124
+ const failure = document.getElementById("contact-failure");
125
+ const mine = (form) => form.id === "contact-form";
126
+ const show = (text) => {
127
+ failure.innerHTML = text ? `<p class="alert danger">${text}</p>` : "";
128
+ };
129
+
130
+ document.addEventListener("actual:ajax-start", ({ detail }) => {
131
+ if (mine(detail.form)) show("");
132
+ });
133
+ document.addEventListener("actual:ajax-response", ({ detail }) => {
134
+ const { response } = detail;
135
+ if (mine(detail.form) && !response.ok && response.status !== 422) {
136
+ show("The message could not be sent. Try again.");
137
+ }
138
+ });
139
+ document.addEventListener("actual:ajax-error", ({ detail }) => {
140
+ if (mine(detail.form)) show("No connection. Your message is kept; try again.");
141
+ });
142
+ ```
143
+
78
144
  ## With unsaved changes
79
145
 
80
146
  The module never decides that a response means "saved". With