CONTRIBUTOR-DOCS / Project planning / Components / Illustrated Message / Illustrated message accessibility migration analysis
In this doc
This doc defines how swc-illustrated-message should work for accessibility and heading semantics. It targets WCAG 2.2 Level AA.
- Illustrated message migration roadmap for layout, CSS, DOM, and Spectrum 2 gaps.
- A composed empty state or explanatory block: illustration (often SVG), a title-like line, description text, and optionally actions.
- It can appear anywhere on a page—inside a dialog, under a page
h1, as the only content of a section, nested in cards, etc.
The component cannot know which h2–h6 level is correct for the page; authors must set that explicitly. The only supported pattern is: title text comes from the heading slot (see below), and the semantic heading element is always created in shadow DOM.
Do not use h1 for the illustrated message title. h1 is for the primary page (or dialog / sheet title outside this block). This component exposes h2–h6 only via heading-level (2–6).
2nd-gen must implement:
heading-levelproperty (attributeheading-level): integers2–6, default2. The shadow tree renders exactly one<h2>…<h6>matching that value. Values outside2–6(including1) must be clamped or coerced to2–6(for example1→2), or rejected in types with a documented default—pick one policy and document it in Storybook.headingslot: accepts aspanonly (or equivalent documented phrasing: a singlespanwrapper as the slotted node). Do not allow slotted<h1>–<h6>; authors must not put heading elements in light DOM for this slot. Implementation may validate in dev and warn or ignore invalid slotted tags.
This differs from putting a real heading in the slot (as in accordion item titles) and from 1st-gen, which always wraps the slot in <h2> with no level control. Accordion still allows level 1–6 on the parent (SWC-1466, PR #5969); illustrated message uses heading-level 2–6 only (no h1).
Documentation and Storybook must tell authors to set heading-level from document outline, not from visual preference alone.
- The APG does not define an “illustrated message” widget. Treat it as structured content: headings, text, optional controls.
| Idea | Plain meaning |
|---|---|
| Info and relationships (WCAG 1.3.1) | The programmatic heading level must reflect the document outline. Avoid a second h1 inside this pattern—keep one top-level heading per page view. |
| Headings and labels (WCAG 2.4.6) | The title should describe topic purpose; heading-level should match sibling and parent headings (h2–h6). |
| Name, role, value (WCAG 4.1.2) | Action buttons and links need discernible names; decorative illustrations should not pollute the accessibility tree. |
Bottom line: Authors choose heading-level (2–6, i.e. h2–h6) to match the page. The component always emits the corresponding heading in shadow DOM; the slot does not supply the heading tag.
| Topic | What to do |
|---|---|
No h1 |
Never render <h1>. Do not accept heading-level="1". h1 belongs to the page, shell, or dialog title, not this block. |
heading-level |
Required behavior: 2–6, default 2. Clamp or coerce out-of-range values; document behavior for invalid input (same spirit as accordion getHeadingLevel()). |
heading slot |
Span only: document that the slot must contain a span (or stricter: exactly one root span). No slotted <h1>–<h6>. |
| Shadow heading | Single heading element in shadow DOM; tag is <h2>–<h6> per heading-level. Slot and/or heading attribute supply text content inside that element (not the element type). |
heading slot |
Only mechanism for providing heading content; no attribute fallback. |
| Docs | Examples across heading-level 2–6 (for example below page h1 vs nested under h3). Contrast with accordion: accordion allows level 1; illustrated message does not. |
| Topic | What to do |
|---|---|
| Illustration (default slot) | If purely decorative, aria-hidden="true" on the SVG (or equivalent). If meaningful, role="img" and aria-label / <title> (see icon and SVG accessibility patterns). |
| Description | Body text; links inside description must be real <a> or link components with visible names. |
button-group slot (Spectrum 2) |
Slotted buttons follow button and action group labeling; order matches visual reading order. |
- If
aria-labelledby/aria-describedbyreference slotted ids, confirm 2nd-gen id forwarding or document limitations. Headingidfor region labeling should live on the shadow<h2>–<h6>if needed.
Typical open state
- One heading: correct
h2–h6fromheading-level, with label text from theheadingslot (spancontent). - Description as text content (and focusable links if present).
- Illustration exposed or hidden per decorative vs informative rules.
- The host is not a single tab stop unless design adds interactive chrome; Tab moves to slotted actions and links in DOM order.
- No requirement for arrow-key widget behavior unless actions compose a pattern (for example button group docs).
sp-illustrated-messagealways wraps the heading slot in<h2 id="heading">(IllustratedMessage.ts) with noheading-levelAPI—authors cannot match outline when the block should beh3–h6.- The slot accepts any node; slotted heading elements would nest incorrectly inside
<h2>. 2nd-gen fixes this by owning the heading tag and restricting the slot tospanonly.
| Kind of test | What to check |
|---|---|
| Unit | Rendered tag is h2–h6 matching heading-level; default 2; heading-level 1 never produces h1; invalid values coerce per spec; heading slot rejects or ignores non-span root if that is the contract. |
| aXe + Storybook | Heading order sane; no h1 inside illustrated message stories; no empty headings when title required. |
| Integration | Dropzone and dialog demos set heading-level appropriately for context. |
- API documented:
heading-level2–6(default2);headingslot span-only; shadow DOM owns<h2>–<h6>; no<h1>. - Storybook examples vary
heading-levelby context (not always2). - 1st-gen fixed
h2called out as migration motivation; link SWC-1466 / accordion for “configurable level” precedent only (different slot rules). - Decorative vs meaningful illustration documented for SVG slot.
-
button-groupslot meets button label requirements.
- WCAG 2.2
- Understanding info and relationships (1.3.1)
- Understanding headings and labels (2.4.6)
- feat(accordion): add
levelproperty for controlling title heading (PR #5969) — precedent for a numeric heading level on a parent; illustrated message usesheading-level2–6, span-only title slot, and shadow-owned heading tag (SWC-1466). - Illustrated message migration roadmap
- SWC-1466 (Adobe internal Jira): accordion heading level; analogous motivation for configurable
heading-levelon illustrated message.