Organism · beta · v1.0.0 · owner: Site system lead · contract 19 of 20 points (open: figma)
Do and don't
Do: The lesson
Rendered by academy-lesson.tsOpen example: Try a lesson · Do: The lesson Use the full-page example to follow page links.
Do: Results explain
Rendered by academy-lesson.tsOpen example: Try a lesson · Do: Results explain Use the full-page example to follow page links.
Don't: A correct answer that teaches the anti-pattern
Rendered by academy-lesson.tsOpen example: Try a lesson · Don't: A correct answer that teaches the anti-pattern Use the full-page example to follow page links.
Don't: A visible live region
Rendered by academy-lesson.tsOpen example: Try a lesson · Don't: A visible live region Use the full-page example to follow page links.
Rules
| Rule | Why | Check |
|---|---|---|
| Try a lesson is computed by Loom's code from one Harbor UI lesson whose answers are checked by Loom's audit at build time, not drawn by hand. | A showcase is proof only if the product's own code produced what it shows. | Automated: scripts/site/interactives/check.ts (recomputes the showcase data and fails on drift) |
| Each fix's result is computed by Loom's audit at build time. | The lesson teaches what the checks enforce. | Automated: tests/unit/site-academy.test.ts |
API
No props.
Contract details
The full contract: identity, anatomy, variants, states, tokens, layout, motion, accessibility, content, tests
Identity
| Aspect | Value |
|---|---|
| Id | academy-lesson |
| Layer | Organisms |
| Category | showcase |
| Owner | Site system lead |
| Status | beta |
| Version | 1.0.0 |
| Source | apps/showcase/site/system/organisms/academy-lesson.ts (private repository; the contract and the render function are this one module) |
| Version | Date | Change |
|---|---|---|
| 1.0.0 | 2026-10-26 | Try a lesson: computed by Loom's code from one Harbor UI lesson whose answers are checked by Loom's audit at build time. |
Use when
- The Academy page. Why: Trying one lesson shows how the Academy teaches with the system's own rules.
Do not use when
- To certify anyone. Why: Certificates come from the Academy in the reader's repository, not this sample.
Anatomy
| Part | What it is |
|---|---|
| root | div.al |
| frame | div.al-frame |
| task | The task and the seeded code |
| fixes | Disclosure list of fixes, one open at a time |
| result | Passes / not yet, with the reason |
| status | Visually hidden live region |
Made of: showcase-frame, code-block, control, caption.
Used in: pages directly.
Variants
| Variant | When | Why |
|---|---|---|
| full | On its demo page and its section. | The whole experience where the claim is made. |
States
| State | Rendered or not applicable |
|---|---|
| default | Task, code and closed fixes |
| hover | Fix labels underline. |
| focus-visible | The --focus ring on each fix. |
| active | Not applicable: Summaries have no pressed state. |
| disabled | Not applicable: Never. |
| loading | Computed lesson results and native disclosures remain usable while the optional exclusivity/status enhancement loads. |
| empty | Not applicable: Always has fixes. |
| error | Caught chunk/initialization failure keeps the native disclosure lesson and computed results readable; no ready result is claimed for failed enhancement. |
| current | Not applicable: No navigation. |
| visited | Not applicable: Not links. |
| expanded | One fix open at a time, with its result. |
Tokens
| Part | Token |
|---|---|
| result.passed | --teal-ink |
| result.failed | --madder-ink |
| code.ground | --term-bg |
| --academy-lesson-margin-space-8 | var(--space-8) |
| --academy-lesson-background-surface | var(--surface) |
| --academy-lesson-color-ink | var(--ink) |
| --academy-lesson-border-line | var(--line) |
| --academy-lesson-border-radius-radius | var(--radius) |
| --academy-lesson-padding-space-6 | var(--space-6) |
| --academy-lesson-color-ink-2 | var(--ink-2) |
| --academy-lesson-font-type-label | var(--type-label) |
| --academy-lesson-margin-space-4 | var(--space-4) |
| --academy-lesson-padding-inline-start-space-7 | var(--space-7) |
| --academy-lesson-background-term-bg | var(--term-bg) |
| --academy-lesson-color-term-fg | var(--term-fg) |
| --academy-lesson-padding-space-5 | var(--space-5) |
| --academy-lesson-font-type-figure | var(--type-figure) |
| --academy-lesson-gap-space-4 | var(--space-4) |
| --academy-lesson-padding-space-4 | var(--space-4) |
| --academy-lesson-background-surface-2 | var(--surface-2) |
| --academy-lesson-outline-focus | var(--focus) |
| --academy-lesson-color-teal-ink | var(--teal-ink) |
| --academy-lesson-color-madder-ink | var(--madder-ink) |
| --academy-lesson-font-type-small | var(--type-small) |
| --academy-lesson-margin-top-space-4 | var(--space-4) |
| --academy-lesson-padding-space-8 | var(--space-8) |
Layout
| Aspect | Value |
|---|---|
| breakpoints | Required review at 390, 768, 1024 and 1440 px; execution is not implied by this declaration; columns stack under 768 px and controls fill the row on phones. |
| wrapping | Text wraps; code panes scroll inside their own focusable region. |
| textExpansion | Japanese strings come from the i18n tables and wrap; engine output stays English. |
Spacing and rhythm
| Aspect | Value |
|---|---|
| internal | Inside the Showcase frame's padding, controls and caption at its foot. |
| external | Full width of its section. |
| rhythm | One showcase per section, after the section's claim (D-SITE-008). |
Motion
| Aspect | Value |
|---|---|
| None | Opening a fix shows its result; nothing plays. |
Runtime and reuse
stylesheet: /css/site.css. Built Site tokens, core and registered element CSS; preserve modes, focus and responsive rules.
stylesheet: /css/demos.css. Existing legacy demo styles where the rendered specimen uses them.
font: /fonts/. Self-hosted files referenced by Site @font-face, with licences; Japanese locale overrides remain applicable.
Static fallback: Original build-time specimen remains readable before loading and after chunk/initialization failure; enhancement controls retain authored hidden state.
Configured initializer: scripts/site/academy/try-lesson.client.ts#init. The host owns transactional static-markup restoration and runtime state.
Consumer module (imports relative to the configured source root): import { createRuntimeHost } from "./src/workflows/runtime-host"; import { SITE_RUNTIMES } from "./apps/showcase/site/runtime-registry"; const definition = SITE_RUNTIMES.find(entry => entry.binding.id === "academy-lesson"); if (!definition || definition.binding.lifecycle.kind !== "managed") throw new Error("Managed runtime binding unavailable"); const host = createRuntimeHost([definition]); export function mountRuntime(container: ParentNode) { return host.mountAll(container); }After inserting the rendered markup, call mountRuntime(container) for the container holding [data-demo="academy-lesson"]. Retain the returned disposal function and call it before removing, replacing or remounting, including every Storybook args render. The configured host restores captured static markup/attributes on disposal or caught load/initialization failure; retry starts a fresh managed remount.
Accessibility passport
| Aspect | Value |
|---|---|
| role | region with a heading, or a figure |
| name | Its heading or caption |
| keyboard | Tab to the controls; Space plays or pauses; arrows move the steps; End shows the last step. |
| focus | Controls in reading order; focus never moves on its own. |
| screenReader | Manual frame selection and pause announce their settled content. Explicit Play announces the final settled summary once; autoplay and system interruption/disposal stay silent. Legacy initializers outside the shared player remain explicitly unassessed. |
| contrast | Ink on surface 14:1; state dyes only as marks with words. |
| target | Controls are 44 px. |
Content
| Slot | Length | Voice |
|---|---|---|
| result | 1 sentence | Passes / Not yet, and why |
Good: “Not yet: primitives skip the role. Use --semantic-text so a theme change reaches this text.”
Bad: “Wrong!”
Japanese: The lesson is English; the Academy page says so in Japanese.
Icons and illustrations
None: this element uses no icon or illustration of its own.
Decisions and exceptions
Usage
27 uses across the built pages (measured by npm run site:system).
Tests
| Aspect | Value |
|---|---|
| unit | tests/unit/site-system.test.ts: renders every do and don't example through the registry and checks the classes it owns |
| visual | Not yet: there are no screenshot baselines; the Library page is checked for sideways scroll at 1440 px by tests/site/system.spec.ts |
| a11y | tests/site/system.spec.ts: axe (0 serious or critical) on the element's Library page in light and dark |
| parity | scripts/site/system/check.ts: Library examples are rendered by the same render function the site imports |
Figma
not-yet: The Loom Site Figma library is the last stage of the plan; this element is not mapped yet.