@hegemonart/get-design-done 1.16.0 → 1.18.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/.claude-plugin/marketplace.json +7 -5
- package/.claude-plugin/plugin.json +17 -5
- package/CHANGELOG.md +84 -0
- package/README.md +20 -2
- package/agents/design-auditor.md +60 -1
- package/agents/design-doc-writer.md +21 -0
- package/agents/design-executor.md +22 -4
- package/agents/design-pattern-mapper.md +61 -0
- package/agents/motion-mapper.md +74 -9
- package/agents/token-mapper.md +8 -0
- package/package.json +10 -2
- package/reference/components/README.md +27 -23
- package/reference/components/alert.md +198 -0
- package/reference/components/badge.md +202 -0
- package/reference/components/breadcrumbs.md +198 -0
- package/reference/components/chip.md +209 -0
- package/reference/components/command-palette.md +228 -0
- package/reference/components/date-picker.md +227 -0
- package/reference/components/file-upload.md +219 -0
- package/reference/components/list.md +217 -0
- package/reference/components/menu.md +212 -0
- package/reference/components/navbar.md +211 -0
- package/reference/components/pagination.md +205 -0
- package/reference/components/progress.md +210 -0
- package/reference/components/rich-text-editor.md +226 -0
- package/reference/components/sidebar.md +211 -0
- package/reference/components/skeleton.md +197 -0
- package/reference/components/slider.md +208 -0
- package/reference/components/stepper.md +220 -0
- package/reference/components/table.md +229 -0
- package/reference/components/toast.md +200 -0
- package/reference/components/tree.md +225 -0
- package/reference/css-grid-layout.md +835 -0
- package/reference/external/NOTICE.hyperframes +28 -0
- package/reference/image-optimization.md +582 -0
- package/reference/motion-advanced.md +754 -0
- package/reference/motion-easings.md +381 -0
- package/reference/motion-interpolate.md +282 -0
- package/reference/motion-spring.md +234 -0
- package/reference/motion-transition-taxonomy.md +155 -0
- package/reference/motion.md +20 -0
- package/reference/output-contracts/motion-map.schema.json +135 -0
- package/reference/registry.json +183 -0
- package/reference/registry.schema.json +4 -0
- package/reference/variable-fonts-loading.md +532 -0
- package/scripts/lib/easings.cjs +280 -0
- package/scripts/lib/parse-contract.cjs +220 -0
- package/scripts/lib/spring.cjs +160 -0
- package/scripts/tests/test-motion-provenance.sh +64 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Rich-Text Editor — Benchmark Spec
|
|
2
|
+
|
|
3
|
+
**Harvested from**: Tiptap/ProseMirror, Lexical (Meta), Slate.js, Atlassian Fabric Editor
|
|
4
|
+
**Wave**: 5 · **Category**: Advanced
|
|
5
|
+
**Spec file**: `reference/components/rich-text-editor.md`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
A Rich-Text Editor (RTE) provides WYSIWYG content authoring with inline formatting (bold, italic, links), block-level elements (headings, lists, blockquotes), and optional advanced features (mentions, embeds, tables). It is appropriate for long-form content where plain `<textarea>` is insufficient and a full CMS-style document editor is overkill. *(Tiptap, Lexical, Atlassian agree: contenteditable + ProseMirror/Lexical model + explicit toolbar is the production-grade RTE pattern.)*
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Anatomy
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌── role="toolbar" aria-label="Text formatting" ──────────────────┐
|
|
19
|
+
│ [B] [I] [U] [S] │ [H1][H2] │ [• List][1. List] │ [Link][Image] │
|
|
20
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
21
|
+
┌── role="textbox" aria-multiline="true" aria-label="Post body" ──┐
|
|
22
|
+
│ │
|
|
23
|
+
│ Start typing here… (placeholder via CSS ::before) │
|
|
24
|
+
│ │
|
|
25
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Part | Required | Notes |
|
|
29
|
+
|------|----------|-------|
|
|
30
|
+
| Editable area | Yes | `contenteditable="true"` + `role="textbox"` + `aria-multiline="true"` |
|
|
31
|
+
| Toolbar | Yes (for formatting) | `role="toolbar"` + `aria-label`; groups via `role="group"` |
|
|
32
|
+
| Toolbar buttons | Yes | `role="button"`; toggle buttons add `aria-pressed` |
|
|
33
|
+
| Placeholder | No | CSS `[data-placeholder]::before` — NOT HTML attribute |
|
|
34
|
+
| Mention list | No | `role="listbox"` floating suggestion list triggered by `@` |
|
|
35
|
+
| Character count | No | `aria-live="polite"` updated region |
|
|
36
|
+
| Read-only overlay | No | `contenteditable="false"` + `aria-readonly="true"` |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Variants
|
|
41
|
+
|
|
42
|
+
| Variant | Description | Systems |
|
|
43
|
+
|---------|-------------|---------|
|
|
44
|
+
| Minimal | Bold/italic/underline + link only | Tiptap (StarterKit minimal), Atlassian (inline comment) |
|
|
45
|
+
| Standard | Full paragraph formatting + lists + links | Tiptap, Lexical, Slate |
|
|
46
|
+
| Document | Full editor with headings, tables, embeds, mentions | Atlassian Fabric Editor, Tiptap (full), Lexical (full) |
|
|
47
|
+
| Read-only | Rendered content; no editing | All systems |
|
|
48
|
+
| Bubble toolbar | Formatting toolbar appears on text selection (tooltip style) | Tiptap, Atlassian inline editor |
|
|
49
|
+
|
|
50
|
+
**Norm** (≥3/4 systems agree): toolbar at top or on selection; contenteditable with explicit role="textbox"; keyboard shortcuts for core formatting.
|
|
51
|
+
**Diverge**: Atlassian uses a floating toolbar on selection; Tiptap supports both fixed and bubble modes; Lexical uses a plugin architecture; Slate treats everything as React tree nodes.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## States
|
|
56
|
+
|
|
57
|
+
| State | Trigger | Visual | ARIA |
|
|
58
|
+
|-------|---------|--------|------|
|
|
59
|
+
| default | — | Cursor; toolbar buttons at rest | — |
|
|
60
|
+
| focused | Click or Tab into editable area | Focus ring on editable container | — |
|
|
61
|
+
| toolbar button active | Text with formatting selected | `aria-pressed="true"` on toggle button | `aria-pressed="true"` |
|
|
62
|
+
| placeholder | No content in editable area | Placeholder text via CSS ::before | — |
|
|
63
|
+
| read-only | `readOnly` prop | No cursor change; grayed toolbar | `aria-readonly="true"`, `contenteditable="false"` |
|
|
64
|
+
| disabled | `disabled` prop | 38% opacity; no interaction | `aria-disabled="true"` |
|
|
65
|
+
| mention-open | `@` typed | Floating listbox appears | `role="listbox"` visible |
|
|
66
|
+
| error | Validation failure | Red border; error message below | `aria-describedby` → error message |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Sizing & Spacing
|
|
71
|
+
|
|
72
|
+
| Size | Min Height | Toolbar Height | Font |
|
|
73
|
+
|------|-----------|----------------|------|
|
|
74
|
+
| sm | 80px | 32px | 13px |
|
|
75
|
+
| md (default) | 160px | 40px | 14px |
|
|
76
|
+
| lg | 320px | 48px | 16px |
|
|
77
|
+
|
|
78
|
+
**Norm**: Editor area grows with content (auto-height); enforce max-height with overflow scroll if needed. Toolbar buttons follow button-sm/md sizing with 8px gaps between groups *(Atlassian, Tiptap)*.
|
|
79
|
+
|
|
80
|
+
Cross-link: `reference/surfaces.md` — toolbar button hit targets.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Typography
|
|
85
|
+
|
|
86
|
+
- Editor content: body-md, line-height 1.6 for readable long-form text
|
|
87
|
+
- Heading 1: 2em; Heading 2: 1.5em; Heading 3: 1.25em — relative to editor base font
|
|
88
|
+
- Code blocks: monospace, 0.9em, background token surface-code
|
|
89
|
+
- Placeholder text: same size/font as body, secondary color via CSS
|
|
90
|
+
|
|
91
|
+
Cross-link: `reference/typography.md` — heading scale, code font stack.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Keyboard & Accessibility
|
|
96
|
+
|
|
97
|
+
> **WAI-ARIA role**: `textbox` (editable area), `toolbar` (toolbar container), `group` (toolbar sections), `button` (toolbar actions), `listbox` (mention suggestions)
|
|
98
|
+
> **Required attributes**: `role="textbox"` + `aria-multiline="true"` + `aria-label` or `aria-labelledby` on editable area; `aria-pressed` on toggle toolbar buttons; `role="toolbar"` + `aria-label` on toolbar
|
|
99
|
+
|
|
100
|
+
### Keyboard Contract
|
|
101
|
+
|
|
102
|
+
*Derived from WAI-ARIA APG toolbar pattern — https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/ — W3C — 2024, and standard contenteditable browser behavior*
|
|
103
|
+
|
|
104
|
+
| Key | Action |
|
|
105
|
+
|-----|--------|
|
|
106
|
+
| Tab | Move focus into the editable area from outside; move out of editor |
|
|
107
|
+
| Ctrl/Cmd + B | Toggle bold on selected text |
|
|
108
|
+
| Ctrl/Cmd + I | Toggle italic on selected text |
|
|
109
|
+
| Ctrl/Cmd + U | Toggle underline on selected text |
|
|
110
|
+
| Ctrl/Cmd + Z | Undo last action |
|
|
111
|
+
| Ctrl/Cmd + Shift + Z | Redo |
|
|
112
|
+
| Ctrl/Cmd + K | Insert or edit link |
|
|
113
|
+
| @ (in editor) | Trigger mention suggestion list |
|
|
114
|
+
| Arrow keys (in listbox) | Navigate mention suggestions |
|
|
115
|
+
| Enter / Space (in listbox) | Select mention suggestion |
|
|
116
|
+
| Escape (in listbox) | Dismiss mention list |
|
|
117
|
+
| F10 or Alt + F10 | Move focus from editable area to toolbar (accessibility shortcut) |
|
|
118
|
+
| Arrow keys (in toolbar) | Move between toolbar buttons (roving tabindex) |
|
|
119
|
+
| Home / End (in toolbar) | First / last toolbar button |
|
|
120
|
+
|
|
121
|
+
### Accessibility Rules
|
|
122
|
+
|
|
123
|
+
- Editable area MUST have `role="textbox"` — bare `contenteditable` is announced as a generic region by most AT
|
|
124
|
+
- `aria-multiline="true"` MUST be set — announces correct Enter-key behavior to screen readers
|
|
125
|
+
- Toolbar toggle buttons (bold, italic, lists) MUST use `aria-pressed="true/false"` to reflect current selection state
|
|
126
|
+
- Placeholder MUST use CSS `[data-placeholder]::before` content — not a `placeholder` HTML attribute on contenteditable (screen readers read it incorrectly or not at all)
|
|
127
|
+
- Keyboard shortcuts MUST be documented in a tooltip or help section — not assumed
|
|
128
|
+
- Read-only: set both `contenteditable="false"` AND `aria-readonly="true"` — contenteditable="false" alone is insufficient for AT
|
|
129
|
+
- Mention listbox MUST use `role="listbox"` with `role="option"` items; focused option uses `aria-selected="true"`
|
|
130
|
+
|
|
131
|
+
Cross-link: `reference/accessibility.md` — contenteditable accessibility, toolbar pattern.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Motion
|
|
136
|
+
|
|
137
|
+
| Transition | Duration | Easing | Notes |
|
|
138
|
+
|------------|----------|--------|-------|
|
|
139
|
+
| Toolbar button active state | 80ms | ease-out | Background fill on aria-pressed change |
|
|
140
|
+
| Mention list open | 150ms | ease-out | Fade + slide up from caret position |
|
|
141
|
+
| Mention list dismiss | 100ms | ease-in | Fade out |
|
|
142
|
+
| Bubble toolbar appear | 150ms | ease-out | Fade in above selection |
|
|
143
|
+
| Bubble toolbar dismiss | 80ms | ease-in | Fade out on deselect |
|
|
144
|
+
|
|
145
|
+
**BAN**: Do not animate text reflow on formatting changes — typing performance is critical; any CSS transition on editor content causes visual jitter.
|
|
146
|
+
|
|
147
|
+
Cross-link: `reference/motion.md` — reduced-motion: remove mention list slide; keep instant formatting toggle.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Do / Don't
|
|
152
|
+
|
|
153
|
+
### Do
|
|
154
|
+
- Add `role="textbox"` + `aria-multiline="true"` to the contenteditable element *(WAI-ARIA APG)*
|
|
155
|
+
- Use `aria-pressed` on all toggle toolbar buttons (bold, italic, list toggles) *(WAI-ARIA APG toolbar pattern)*
|
|
156
|
+
- Implement placeholder via CSS `::before` pseudo-element, not HTML attribute *(Tiptap, Atlassian)*
|
|
157
|
+
- Document keyboard shortcuts in a tooltip or accessible help dialog *(Atlassian Fabric Editor)*
|
|
158
|
+
|
|
159
|
+
### Don't
|
|
160
|
+
- Don't use bare `contenteditable` without `role="textbox"` — AT announces it as a generic landmark *(diverges from all 4 systems)*
|
|
161
|
+
- Don't omit `aria-pressed` on toggle buttons — AT users cannot determine current formatting state *(WAI-ARIA APG)*
|
|
162
|
+
- Don't use a `placeholder` HTML attribute on contenteditable — it is not a valid attribute and screen reader behavior is undefined *(MDN, Tiptap docs)*
|
|
163
|
+
- Don't suppress `outline` on the editable area without a custom focus-visible ring *(WCAG 2.4.7)*
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Anti-patterns Cross-links
|
|
168
|
+
|
|
169
|
+
| Anti-pattern | Entry |
|
|
170
|
+
|--------------|-------|
|
|
171
|
+
| BAN-06 | contenteditable without role="textbox" — `reference/anti-patterns.md#ban-06` |
|
|
172
|
+
| BAN-04 | transition: all on editor content causing reflow jank — `reference/anti-patterns.md#ban-04` |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Benchmark Citations
|
|
177
|
+
|
|
178
|
+
| Claim | Sources |
|
|
179
|
+
|-------|---------|
|
|
180
|
+
| contenteditable needs role="textbox" + aria-multiline="true" | WAI-ARIA spec, Tiptap a11y guide, Atlassian |
|
|
181
|
+
| Toolbar toggle buttons need aria-pressed | WAI-ARIA APG toolbar pattern |
|
|
182
|
+
| Placeholder via CSS ::before, not HTML attribute | Tiptap docs, Atlassian Fabric Editor |
|
|
183
|
+
| Mention list uses role="listbox" + role="option" | Tiptap mention extension, Lexical mention plugin |
|
|
184
|
+
| Ctrl/Cmd+B/I/U keyboard shortcuts are standard | Lexical, Tiptap, Slate — all implement these |
|
|
185
|
+
|
|
186
|
+
Full system URLs: `connections/design-corpora.md`
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Grep Signatures
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# contenteditable element missing role="textbox" (announced as generic region)
|
|
194
|
+
grep -rn 'contenteditable="true"' src/ | grep -v 'role="textbox"'
|
|
195
|
+
|
|
196
|
+
# Toolbar toggle buttons missing aria-pressed
|
|
197
|
+
grep -rn 'role="toolbar"' src/ -A 50 | grep 'role="button"' | grep -v 'aria-pressed'
|
|
198
|
+
|
|
199
|
+
# Placeholder set as HTML attribute on contenteditable (invalid)
|
|
200
|
+
grep -rn 'contenteditable' src/ | grep 'placeholder='
|
|
201
|
+
|
|
202
|
+
# Mention listbox missing role="listbox"
|
|
203
|
+
grep -rn 'mention\|@mention\|MentionList' src/ | grep -v 'role="listbox"'
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Failing Example
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<!-- BAD: rich-text area using only contenteditable without role="textbox" -->
|
|
212
|
+
<div
|
|
213
|
+
contenteditable="true"
|
|
214
|
+
class="editor"
|
|
215
|
+
placeholder="Start writing..."
|
|
216
|
+
>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="toolbar">
|
|
219
|
+
<button onclick="document.execCommand('bold')">B</button>
|
|
220
|
+
<button onclick="document.execCommand('italic')">I</button>
|
|
221
|
+
</div>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Why it fails**: (1) Bare `contenteditable` is announced by most AT as a generic region, not a text input — users do not know they can type. (2) `placeholder` is not a valid HTML attribute on `<div>` — screen readers do not announce it. (3) Toolbar buttons have no `aria-pressed` — AT cannot determine if bold/italic is currently active. (4) `document.execCommand` is deprecated.
|
|
225
|
+
**Grep detection**: `grep -rn 'contenteditable="true"' src/ | grep -v 'role="textbox"'`
|
|
226
|
+
**Fix**: Add `role="textbox"` + `aria-multiline="true"` + `aria-label="Post body"` to the editable div; implement placeholder via CSS `[data-empty]::before { content: attr(data-placeholder) }`; add `aria-pressed="true/false"` to toolbar toggle buttons; use a modern editor library (Tiptap, Lexical) instead of execCommand.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Sidebar (Collapsible Side Navigation Panel) — Benchmark Spec
|
|
2
|
+
|
|
3
|
+
**Harvested from**: Material 3, Carbon, Polaris, Atlassian, UUPM (app-interface, MIT)
|
|
4
|
+
**Wave**: 4 · **Category**: Navigation
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
A sidebar provides persistent or collapsible secondary navigation along the vertical axis of an application. In expanded state it shows icon + label; in collapsed state it shows icon only (with a tooltip). It is distinct from a Drawer (which is a modal overlay — see `drawer.md`) and from a Navbar (primary horizontal navigation). Use a sidebar for application-level section switching and hierarchical settings navigation. *(Material 3 Navigation Drawer, Carbon UI Shell Left Nav, Atlassian SideNavigation, Polaris Navigation agree)*
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Anatomy
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
┌─────────────────┐ ┌────┐
|
|
18
|
+
│ [≡] App Name │ ◄──► │[≡] │ collapsed (icon-only)
|
|
19
|
+
│─────────────────│ │────│
|
|
20
|
+
│ 🏠 Dashboard │ │[🏠]│ tooltip: "Dashboard"
|
|
21
|
+
│ 📊 Analytics │ │[📊]│
|
|
22
|
+
│ ▾ Settings │ │[⚙] │
|
|
23
|
+
│ Account │ └────┘
|
|
24
|
+
│ Privacy │
|
|
25
|
+
│ Security │
|
|
26
|
+
└─────────────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Part | Required | Notes |
|
|
30
|
+
|------|----------|-------|
|
|
31
|
+
| `<nav>` wrapper | Yes | `role="navigation"` + `aria-label="Secondary"` |
|
|
32
|
+
| Toggle button | Yes | `aria-expanded` + `aria-controls` pointing to nav |
|
|
33
|
+
| Nav item | Yes | `<a>` for routing; `<button>` for non-routing actions |
|
|
34
|
+
| Sub-section toggle | No | `<button>` with `aria-expanded`; chevron icon rotates |
|
|
35
|
+
| Sub-section items | No | Indented child items; hidden when parent collapsed |
|
|
36
|
+
| Tooltip | Conditional | On icon-only items in collapsed state; `role="tooltip"` |
|
|
37
|
+
| Active indicator | Yes | `aria-current="page"` on active item |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Variants
|
|
42
|
+
|
|
43
|
+
| Variant | Description | Systems |
|
|
44
|
+
|---------|-------------|---------|
|
|
45
|
+
| Expanded | Icon + label visible; full width (240–280px) | All systems |
|
|
46
|
+
| Collapsed / mini | Icon only; 48–64px wide; tooltips on hover/focus | Material 3, Carbon, Atlassian |
|
|
47
|
+
| Floating / overlay | Overlay on top of content (mobile drawer pattern) | Material 3, Polaris |
|
|
48
|
+
| Settings nav | Category tree: Settings › Account › Privacy › Security | UUPM app-interface (MIT) |
|
|
49
|
+
| Dashboard nav | Section switcher: Dashboard / Analytics / Users / Settings | UUPM app-interface (MIT) |
|
|
50
|
+
|
|
51
|
+
**Norm** (≥4 systems agree): expanded width 240–280px; collapsed width 48–64px; toggle button at top or bottom.
|
|
52
|
+
**Diverge**: Carbon collapses to a rail (16px) with hover-expand; Material 3 differentiates between NavigationDrawer (permanent) and ModalNavigationDrawer (mobile).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## States
|
|
57
|
+
|
|
58
|
+
| State | Trigger | Visual | ARIA |
|
|
59
|
+
|-------|---------|--------|------|
|
|
60
|
+
| expanded | default or toggle | Full width, labels visible | `aria-expanded="true"` on toggle |
|
|
61
|
+
| collapsed | toggle click | Icon-only, labels hidden | `aria-expanded="false"` on toggle |
|
|
62
|
+
| item-default | — | Resting fill | — |
|
|
63
|
+
| item-hover | pointer over | 8% overlay | — |
|
|
64
|
+
| item-focus | keyboard focus | 2px focus-visible ring | — |
|
|
65
|
+
| item-active | current route | Filled pill or left indicator bar | `aria-current="page"` |
|
|
66
|
+
| subsection-open | button click | Children visible; chevron rotated 180° | `aria-expanded="true"` on section button |
|
|
67
|
+
| subsection-closed | button click | Children hidden | `aria-expanded="false"` on section button |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Sizing & Spacing
|
|
72
|
+
|
|
73
|
+
| State | Width | Item height | Item padding H |
|
|
74
|
+
|-------|-------|-------------|----------------|
|
|
75
|
+
| Expanded | 240–280px | 40px | 16px |
|
|
76
|
+
| Collapsed | 48–64px | 40px | 12px (centered icon) |
|
|
77
|
+
| Sub-item indent | — | 36px | 32px (16px base + 16px indent) |
|
|
78
|
+
|
|
79
|
+
**Norm**: 240px expanded width (Carbon, Atlassian, Polaris). 40px item height matches button defaults.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Typography
|
|
84
|
+
|
|
85
|
+
- Nav item label: body-sm (13–14px), weight 400; active item weight 500 or 600
|
|
86
|
+
- Sub-section heading (if present): label-xs (11–12px), uppercase, weight 600, `color: --text-subtle`
|
|
87
|
+
- Tooltip: body-xs (11–12px) — concise, matches item label exactly in collapsed state
|
|
88
|
+
- Never truncate nav item labels — resize the sidebar or abbreviate the label intentionally
|
|
89
|
+
|
|
90
|
+
Cross-link: `reference/typography.md` — label scale, body-sm
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Keyboard & Accessibility
|
|
95
|
+
|
|
96
|
+
> **WAI-ARIA role**: `navigation` (wrapper)
|
|
97
|
+
> **Required attributes**: `aria-label="Secondary"` on `<nav>`; `aria-expanded` on toggle button and collapsible section buttons; `aria-current="page"` on active item
|
|
98
|
+
|
|
99
|
+
### Keyboard Contract
|
|
100
|
+
|
|
101
|
+
*Quoted verbatim from WAI-ARIA APG — https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/ — W3C — 2024*
|
|
102
|
+
|
|
103
|
+
| Key | Action |
|
|
104
|
+
|-----|--------|
|
|
105
|
+
| Tab / Shift+Tab | Moves focus through focusable items in DOM order |
|
|
106
|
+
| Enter / Space | Activates focused link (navigates) or button (toggles section/sidebar) |
|
|
107
|
+
| ArrowDown | Moves focus to next visible nav item (optional enhancement) |
|
|
108
|
+
| ArrowUp | Moves focus to previous visible nav item (optional enhancement) |
|
|
109
|
+
| Escape | Closes mobile overlay sidebar; returns focus to toggle |
|
|
110
|
+
|
|
111
|
+
### Accessibility Rules
|
|
112
|
+
|
|
113
|
+
- `<nav>` MUST have `aria-label="Secondary"` to distinguish from the primary navbar landmark
|
|
114
|
+
- Every collapsible sub-section MUST have `aria-expanded` on its toggle button
|
|
115
|
+
- Items that navigate (routing) MUST be `<a href>` links; items that only toggle state MUST be `<button>` (not `<a href="#">`)
|
|
116
|
+
- In collapsed state, each icon-only item MUST have a tooltip AND `aria-label` (tooltip is not a substitute for accessible name)
|
|
117
|
+
- `aria-current="page"` MUST be present on the currently active item
|
|
118
|
+
|
|
119
|
+
Cross-link: `reference/accessibility.md` — landmark labelling, disclosure pattern
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Motion
|
|
124
|
+
|
|
125
|
+
| Transition | Duration | Easing | Notes |
|
|
126
|
+
|------------|----------|--------|-------|
|
|
127
|
+
| Expand / collapse sidebar | 200ms | ease-in-out | Width transition; respect `prefers-reduced-motion` |
|
|
128
|
+
| Sub-section open | 150ms | ease-out | Height expand; `overflow: hidden` clip |
|
|
129
|
+
| Sub-section close | 120ms | ease-in | Height collapse |
|
|
130
|
+
| Chevron rotate | 150ms | ease-in-out | 0° → 180° on open |
|
|
131
|
+
| Label fade in | 100ms | ease-out | Delay until width ≥ 140px to prevent overlap |
|
|
132
|
+
|
|
133
|
+
**BAN**: Animating sidebar width using `transition: all` — catches unrelated property changes and causes jank.
|
|
134
|
+
|
|
135
|
+
Cross-link: `reference/motion.md` — layout transitions, BAN-04
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Do / Don't
|
|
140
|
+
|
|
141
|
+
### Do
|
|
142
|
+
- Use `<a href>` for routing nav items and `<button>` for non-routing actions *(Carbon, WAI-ARIA APG)*
|
|
143
|
+
- Label the `<nav>` with `aria-label="Secondary"` *(WAI-ARIA APG landmark regions)*
|
|
144
|
+
- Show tooltips on icon-only items in collapsed state *(Material 3, Carbon, Atlassian)*
|
|
145
|
+
- Use `aria-expanded` on sub-section toggles *(WAI-ARIA APG disclosure pattern)*
|
|
146
|
+
|
|
147
|
+
### Don't
|
|
148
|
+
- Don't use `<a href="#">` for items that don't navigate — breaks bookmark/open-in-new-tab expectations *(Carbon, WAI-ARIA)*
|
|
149
|
+
- Don't hide sub-items with `display: none` without also removing them from tab order *(WCAG 2.1.1)*
|
|
150
|
+
- Don't use the same `aria-label` on both sidebar nav and top navbar *(WAI-ARIA landmark uniqueness)*
|
|
151
|
+
- Don't collapse the sidebar below 44px touch target width on mobile *(WCAG 2.5.5)*
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Anti-patterns Cross-links
|
|
156
|
+
|
|
157
|
+
| Anti-pattern | Entry |
|
|
158
|
+
|--------------|-------|
|
|
159
|
+
| BAN-04 | `transition: all` on interactive elements — `reference/anti-patterns.md#ban-04` |
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Benchmark Citations
|
|
164
|
+
|
|
165
|
+
| Claim | Sources |
|
|
166
|
+
|-------|---------|
|
|
167
|
+
| aria-label="Secondary" distinct from Primary | WAI-ARIA APG landmark regions, WCAG 4.1.2 |
|
|
168
|
+
| `<button>` for non-routing, `<a>` for routing | Carbon, WAI-ARIA APG, Primer |
|
|
169
|
+
| aria-expanded on collapsible sections | WAI-ARIA APG disclosure pattern |
|
|
170
|
+
| 240px expanded / 48–64px collapsed widths | Carbon, Atlassian, Polaris |
|
|
171
|
+
| Tooltip on icon-only collapsed items | Material 3, Carbon, Atlassian |
|
|
172
|
+
|
|
173
|
+
Full system URLs: `connections/design-corpora.md`
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Grep Signatures
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# nav element missing aria-label
|
|
181
|
+
grep -rn '<nav' src/ | grep -v 'aria-label\|aria-labelledby'
|
|
182
|
+
|
|
183
|
+
# Collapsible section missing aria-expanded
|
|
184
|
+
grep -rn 'sidebar\|sidenav\|side-nav' src/ | grep 'collapsible\|expandable\|toggle' | grep -v 'aria-expanded'
|
|
185
|
+
|
|
186
|
+
# href="#" on nav items (non-routing anchor misuse)
|
|
187
|
+
grep -rn 'href="#"' src/ | grep -i 'nav\|sidebar\|menu'
|
|
188
|
+
|
|
189
|
+
# Active item missing aria-current
|
|
190
|
+
grep -rn 'class.*active\|isActive\|is-active' src/ | grep -i 'nav.*item\|sidebar.*item' | grep -v 'aria-current'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Failing Example
|
|
196
|
+
|
|
197
|
+
```html
|
|
198
|
+
<!-- BAD: sidebar items using <a href="#"> for non-routing actions -->
|
|
199
|
+
<nav> <!-- missing aria-label -->
|
|
200
|
+
<a href="#">Dashboard</a>
|
|
201
|
+
<a href="#">Analytics</a>
|
|
202
|
+
<a href="#" class="active">Settings</a> <!-- no aria-current -->
|
|
203
|
+
<a href="#">
|
|
204
|
+
Account <!-- subsection, but no aria-expanded -->
|
|
205
|
+
</a>
|
|
206
|
+
</nav>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Why it fails**: `<nav>` has no label (ambiguous landmark); `<a href="#">` creates false navigation expectations and adds to browser history; active state uses CSS class only; no `aria-current="page"`; no `aria-expanded` for the sub-section.
|
|
210
|
+
**Grep detection**: `grep -rn 'href="#"' src/ | grep -i 'nav\|sidebar'`
|
|
211
|
+
**Fix**: Replace `<a href="#">` with `<button>` for non-routing items; add `aria-label="Secondary"` to `<nav>`; add `aria-current="page"` to active item; add `aria-expanded` to sub-section toggles.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Skeleton — Benchmark Spec
|
|
2
|
+
|
|
3
|
+
**Harvested from**: Polaris, Carbon, Atlassian, Mantine
|
|
4
|
+
**Wave**: 3 · **Category**: Feedback
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
A skeleton screen is a loading placeholder that mirrors the shape of the content it will replace — text lines, images, cards, avatars. It reduces perceived wait time by showing the structural layout before real data arrives, preventing the jarring reflow that occurs when content suddenly appears. Use skeleton when the content shape is known; use an indeterminate spinner or progress bar when shape is unknown. *(Polaris, Carbon, Atlassian, Mantine agree: skeleton = shape-matched placeholder, not generic spinner)*
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Anatomy
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
┌──────────────────────────────────┐
|
|
18
|
+
│ ████ (avatar-circle, 40px) │ ← aria-hidden="true"
|
|
19
|
+
│ ██████████████████ (text-line) │
|
|
20
|
+
│ █████████████ (text-line 75%) │
|
|
21
|
+
│ ████████████████████ (text-line)│
|
|
22
|
+
└──────────────────────────────────┘
|
|
23
|
+
↑ container: aria-busy="true" aria-label="Loading…"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Part | Required | Notes |
|
|
27
|
+
|------|----------|-------|
|
|
28
|
+
| Container | Yes | `aria-busy="true"` + `aria-label="Loading…"` or `aria-labelledby` |
|
|
29
|
+
| Skeleton elements | Yes | `aria-hidden="true"` on each shape element |
|
|
30
|
+
| Text-line shape | No | Width 60–90% (varied) to mimic text flow |
|
|
31
|
+
| Image/card block | No | Fixed aspect-ratio; fills the same space as the loaded image |
|
|
32
|
+
| Avatar circle | No | Circular shape; diameter matches the final avatar size |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Variants
|
|
37
|
+
|
|
38
|
+
| Variant | Description | Systems |
|
|
39
|
+
|---------|-------------|---------|
|
|
40
|
+
| Text lines | One or more lines at varying widths (60–90%) | All |
|
|
41
|
+
| Image block | Rectangular/aspect-ratio shape for images | Polaris, Carbon, Mantine |
|
|
42
|
+
| Avatar | Circular placeholder at avatar diameter | Polaris, Atlassian, Mantine |
|
|
43
|
+
| Card | Full card-sized block with text-line children | All |
|
|
44
|
+
| Table row | Row-shaped block with column-width children | Carbon, Mantine |
|
|
45
|
+
|
|
46
|
+
**Norm** (≥4/18 systems agree): shimmer animation (left-to-right gradient sweep); vary text-line widths 60–90%; `aria-hidden` on skeleton elements; `aria-busy` on container.
|
|
47
|
+
**Diverge**: Polaris renders skeleton as named sub-components (`SkeletonBodyText`, `SkeletonDisplayText`); Carbon uses CSS class modifiers; Mantine uses a generic `Skeleton` with width/height props; Atlassian uses a shape prop.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## States
|
|
52
|
+
|
|
53
|
+
| State | Trigger | Visual | ARIA |
|
|
54
|
+
|-------|---------|--------|------|
|
|
55
|
+
| loading | data fetch in progress | Shimmer animation looping | `aria-busy="true"` on container |
|
|
56
|
+
| loaded | data resolves | Skeleton removed, real content appears | `aria-busy="false"` or remove attr |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Sizing & Spacing
|
|
61
|
+
|
|
62
|
+
| Shape | Default sizing | Notes |
|
|
63
|
+
|-------|----------------|-------|
|
|
64
|
+
| Text-line | 16px height | Matches body line-height slot |
|
|
65
|
+
| Text-line (heading) | 24–28px height | Matches h2/h3 slot |
|
|
66
|
+
| Avatar | Match target avatar diameter | 32px, 40px, 48px common |
|
|
67
|
+
| Image block | Match target image aspect ratio | 16:9, 1:1, 4:3 common |
|
|
68
|
+
| Gap between text lines | 8px | Matches body line-height rhythm |
|
|
69
|
+
|
|
70
|
+
**Norm**: Match exact pixel dimensions of the content being replaced — layout shift score is zero when skeleton matches final content size *(Polaris, Mantine)*.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Typography
|
|
75
|
+
|
|
76
|
+
Skeleton shapes are purely visual — no typography content. However:
|
|
77
|
+
- Text-line height should match the `line-height` of the real text it replaces
|
|
78
|
+
- Heading skeleton height should match the heading's `font-size` + leading
|
|
79
|
+
- Do NOT use placeholder text ("Loading…") inside skeleton shapes — use `aria-label` on the container instead
|
|
80
|
+
|
|
81
|
+
Cross-link: `reference/typography.md` — line-height scale for matching skeleton dimensions
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Keyboard & Accessibility
|
|
86
|
+
|
|
87
|
+
> **WAI-ARIA role**: no role on skeleton shapes; container uses `aria-busy`
|
|
88
|
+
> **Required attributes**: `aria-hidden="true"` on each skeleton element; `aria-busy="true"` + `aria-label="Loading…"` on container
|
|
89
|
+
|
|
90
|
+
### Keyboard Contract
|
|
91
|
+
|
|
92
|
+
*Quoted verbatim from WAI-ARIA APG — https://www.w3.org/WAI/ARIA/apg/ — W3C — 2024*
|
|
93
|
+
|
|
94
|
+
| Key | Action |
|
|
95
|
+
|-----|--------|
|
|
96
|
+
| (none) | Skeleton shapes are not interactive; no keyboard interaction |
|
|
97
|
+
|
|
98
|
+
Skeleton elements must not receive focus. The container is not focusable unless it wraps focusable content that appears after loading.
|
|
99
|
+
|
|
100
|
+
### Accessibility Rules
|
|
101
|
+
|
|
102
|
+
- Every skeleton shape element MUST have `aria-hidden="true"` — blank shapes announced by screen readers ("image", "text") confuse users *(Polaris, Carbon)*
|
|
103
|
+
- The container MUST have `aria-busy="true"` while loading, set to `false` (or removed) when content appears *(WAI-ARIA APG)*
|
|
104
|
+
- The container MUST have `aria-label="Loading…"` or equivalent — this is what screen readers announce while `aria-busy="true"` *(WAI-ARIA APG)*
|
|
105
|
+
- Do NOT use skeleton as the only loading indicator for screen reader users — announce loading state via live region if the transition is programmatic *(Carbon)*
|
|
106
|
+
- Shimmer animation MUST be suppressed under `prefers-reduced-motion` — use static fill instead *(WCAG 2.3.3)*
|
|
107
|
+
|
|
108
|
+
Cross-link: `reference/accessibility.md` — `aria-busy`, `prefers-reduced-motion`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Motion
|
|
113
|
+
|
|
114
|
+
| Transition | Duration | Easing | Notes |
|
|
115
|
+
|------------|----------|--------|-------|
|
|
116
|
+
| Shimmer sweep | 1.5s | ease-in-out | 130° gradient: transparent → surface-highlight → transparent |
|
|
117
|
+
| Loop delay | 0.5s | — | Pause between sweeps to avoid strobing |
|
|
118
|
+
| Skeleton → content | 200ms | ease-out | Fade-in real content over skeleton |
|
|
119
|
+
|
|
120
|
+
Shimmer gradient direction: 130 degrees (roughly top-left to bottom-right) — matches natural reading direction.
|
|
121
|
+
Background: `surface-variant` token (slightly darker than background surface, lighter than border).
|
|
122
|
+
|
|
123
|
+
**BAN**: High-contrast shimmer (e.g. white → gray on dark) — too visually noisy. Do NOT use spinner animation inside a skeleton shape. Under `prefers-reduced-motion`, remove the sweep entirely and use static fill.
|
|
124
|
+
|
|
125
|
+
Cross-link: `reference/motion.md` — `prefers-reduced-motion`: static fill, no gradient sweep
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Do / Don't
|
|
130
|
+
|
|
131
|
+
### Do
|
|
132
|
+
- Match skeleton dimensions exactly to target content to avoid layout shift *(Polaris, Mantine)*
|
|
133
|
+
- Vary text-line widths 60–90% to simulate natural text flow *(Carbon, Atlassian)*
|
|
134
|
+
- Set `aria-hidden="true"` on every skeleton shape element *(WAI-ARIA APG, Polaris)*
|
|
135
|
+
- Set `aria-busy="true"` + `aria-label="Loading…"` on the container *(WAI-ARIA APG)*
|
|
136
|
+
|
|
137
|
+
### Don't
|
|
138
|
+
- Don't use a spinner when content shape is known — skeleton is always preferred for layout-bearing slots *(Carbon, Polaris)*
|
|
139
|
+
- Don't use strong contrast for shimmer — use `surface-variant` (low contrast) *(Atlassian, Mantine)*
|
|
140
|
+
- Don't animate shimmer under `prefers-reduced-motion` — use static fill *(WCAG 2.3.3)*
|
|
141
|
+
- Don't add visible "Loading…" text inside skeleton shapes — put it on the container via `aria-label` *(Carbon)*
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Anti-patterns Cross-links
|
|
146
|
+
|
|
147
|
+
| Anti-pattern | Entry |
|
|
148
|
+
|--------------|-------|
|
|
149
|
+
| Spinner used when content shape is known | `reference/anti-patterns.md#ban-spinner-overuse` |
|
|
150
|
+
| Missing aria-hidden on visual-only elements | `reference/anti-patterns.md#ban-aria-hidden` |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Benchmark Citations
|
|
155
|
+
|
|
156
|
+
| Claim | Sources |
|
|
157
|
+
|-------|---------|
|
|
158
|
+
| aria-hidden="true" on skeleton shapes | WAI-ARIA APG, Polaris, Carbon |
|
|
159
|
+
| aria-busy="true" on container | WAI-ARIA APG |
|
|
160
|
+
| Text-line widths 60–90% varied | Carbon, Atlassian, Mantine |
|
|
161
|
+
| Shimmer 130° gradient sweep 1.5s | Polaris, Mantine |
|
|
162
|
+
| Suppress shimmer under prefers-reduced-motion | WCAG 2.3.3 |
|
|
163
|
+
| Match exact target dimensions to prevent layout shift | Polaris, Mantine |
|
|
164
|
+
|
|
165
|
+
Full system URLs: `connections/design-corpora.md`
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Grep Signatures
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Skeleton shapes missing aria-hidden
|
|
173
|
+
grep -rn 'skeleton\|Skeleton' src/ | grep -v 'aria-hidden="true"' | grep -v 'aria-busy\|container'
|
|
174
|
+
|
|
175
|
+
# Skeleton container missing aria-busy
|
|
176
|
+
grep -rn 'skeleton\|Skeleton' src/ | grep 'container\|wrapper\|section' | grep -v 'aria-busy'
|
|
177
|
+
|
|
178
|
+
# Shimmer animation without prefers-reduced-motion guard
|
|
179
|
+
grep -rn 'shimmer\|skeleton.*animation\|@keyframes.*skeleton' src/ | grep -v 'prefers-reduced-motion'
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Failing Example
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<!-- BAD: skeleton shapes with no aria-hidden, container with no aria-busy -->
|
|
188
|
+
<div class="card-skeleton">
|
|
189
|
+
<div class="skeleton-avatar"></div>
|
|
190
|
+
<div class="skeleton-line skeleton-line--80"></div>
|
|
191
|
+
<div class="skeleton-line skeleton-line--60"></div>
|
|
192
|
+
</div>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Why it fails**: Screen readers traverse the skeleton shapes and announce them as empty elements ("image", unlabeled regions). There is no `aria-busy="true"` to signal a loading state. No `aria-label` tells the user what is loading. When content loads, no `aria-busy="false"` transition signals completion.
|
|
196
|
+
**Grep detection**: `grep -rn 'skeleton' src/ | grep -v 'aria-hidden\|aria-busy'`
|
|
197
|
+
**Fix**: Add `aria-busy="true" aria-label="Loading card content"` to the container; add `aria-hidden="true"` to every skeleton child shape.
|