# Explainers

An explainer describes a pattern that has **no native HTML element and no
[APG pattern](https://www.w3.org/WAI/ARIA/apg/patterns/)**, written the way a platform feature
would be proposed. The format follows the [W3C TAG explainer guidance](https://tag.w3.org/explainers/)
and the explainers published by [Open UI](https://open-ui.org/). Nothing here is a standard. Each
file says which parts are **Our choice** and why.

## When an explainer is required

domestic-ui uses, in order: a native element, then the matching APG pattern, then ARIA only where
native HTML cannot express something ([PRINCIPLES.md](https://domestic-ui.odonckers.dev/principles/index.md)). A molecule that ends up
with neither a native element nor an APG pattern MUST have an explainer here, linked from the
header comment of its CSS file and from the
[molecules index](https://github.com/odonckers/domestic-ui/blob/main/css/components/molecules/README.md). Layouts with no standard of their own (the [split view](https://domestic-ui.odonckers.dev/explainers/split-view.md), the [app shell](https://domestic-ui.odonckers.dev/explainers/app-shell.md)) may have one too.
Patterns that are backed by a standard
(dialog, details, popover, tabs, menu button, toolbar, breadcrumb, search) link to that standard
instead.

## Keywords

The key words MUST, MUST NOT, SHOULD, SHOULD NOT and MAY are to be interpreted as described in
[RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174)
when, and only when, they appear in all capitals.

## Sections

Every explainer has these sections, in this order:

1. **Problem**: what authors cannot do well today.
2. **Use cases**: concrete situations.
3. **Goals** and 4. **Non-goals**. Goals name the [design principles](https://domestic-ui.odonckers.dev/principles/design-principles.md) the pattern serves.
5. **Proposed markup and API**: the attribute, element or methods we ship, with an example.
6. **Keyboard interaction**.
7. **Accessibility mappings**: roles, states, and what assistive technology users should hear.
8. **Alternatives considered**, each with why it was rejected.
9. **Prior art**, with links. We cite. We do not copy.
10. **Mapping to a future standard**: the nearest standards effort (an Open UI component, a WHATWG or CSSWG
    issue) or "none known", how our markup would map onto it, and what a page would rename if it shipped.
    Where an effort exists, our names follow it.
11. **Open questions**.

Names follow HTML and ARIA conventions (lowercase, no abbreviations, states in native attributes)
so a pattern could map onto a future native element or attribute.

## Index

| Explainer | Summary | CSS | Example | Script |
| --- | --- | --- | --- | --- |
| [Card](https://domestic-ui.odonckers.dev/explainers/card.md) | A self-contained summary with a heading, optional media and actions; a whole-card link whose name is the heading | [`card.css`](https://domestic-ui.odonckers.dev/patterns/card.md) | [Card](https://domestic-ui.odonckers.dev/patterns/card.md) | None |
| [Pagination](https://domestic-ui.odonckers.dev/explainers/pagination.md) | Links between pages of a list in a named `<nav>`, with `aria-current="page"` and non-link disabled ends | [`pagination.css`](https://domestic-ui.odonckers.dev/patterns/pagination.md) | [Pagination](https://domestic-ui.odonckers.dev/patterns/pagination.md) | None |
| [Drawer](https://domestic-ui.odonckers.dev/explainers/drawer.md) | A `<dialog>` variant at the inline-start or inline-end edge, full block size | [`dialog.css`](https://domestic-ui.odonckers.dev/patterns/dialog.md) | [Dialog and drawer](https://domestic-ui.odonckers.dev/patterns/dialog.md) | None |
| [Toast](https://domestic-ui.odonckers.dev/explainers/toast.md) | A fixed `role="status"` region that stacks short messages that never dismiss themselves | [`alerts.css`](https://domestic-ui.odonckers.dev/patterns/alerts.md) | [Alerts](https://domestic-ui.odonckers.dev/patterns/alerts.md) | [`dui-toaster.js`](https://github.com/odonckers/domestic-ui/blob/main/web-components/dui-toaster.js) |
| [Combobox](https://domestic-ui.odonckers.dev/explainers/combobox.md) | How domestic-ui maps the APG list autocomplete combobox onto `<input list>` and `<datalist>`, and the choices the APG leaves open | [`combobox.css`](https://domestic-ui.odonckers.dev/patterns/typeahead.md) | [Typeahead](https://domestic-ui.odonckers.dev/patterns/typeahead.md) | [`dui-combobox.js`](https://github.com/odonckers/domestic-ui/blob/main/web-components/dui-combobox.js) |
| [Density](https://domestic-ui.odonckers.dev/explainers/density.md) | `data-density="compact"` on any element: tighter control heights, padding and table cells, same text size, targets at least 24px | [`semantic.css`](https://domestic-ui.odonckers.dev/tokens/semantic.md) | [Compact density](https://domestic-ui.odonckers.dev/patterns/density.md) | None |
| [App shell](https://domestic-ui.odonckers.dev/explainers/app-shell.md) | `data-app-shell`: app bar, primary sidebar, main and an auxiliary sidebar as native landmarks in named grid areas; one copy of each sidebar, collapsible beside main and a modal drawer when the shell is narrow; why not a dialog, popover, `<details>`, checkbox hack or duplicated navigation | [`app-shell.css`](https://domestic-ui.odonckers.dev/patterns/app-shell.md) | [App shell](https://domestic-ui.odonckers.dev/patterns/app-shell.md) | [`dui-app-shell.js`](https://github.com/odonckers/domestic-ui/blob/main/web-components/dui-app-shell.js) |
| [Auxiliary sidebar](https://domestic-ui.odonckers.dev/explainers/aux-sidebar.md) | The `<aside>` after `<main>` in an app shell: context for the selection, beside main from 64rem, a drawer at the end below; stable name, polite status on change | [`app-shell.css`](https://domestic-ui.odonckers.dev/patterns/app-shell.md) | [App shell](https://domestic-ui.odonckers.dev/patterns/app-shell.md) | [`dui-app-shell.js`](https://github.com/odonckers/domestic-ui/blob/main/web-components/dui-app-shell.js) |
| [Split view](https://domestic-ui.odonckers.dev/explainers/split-view.md) | Two regions side by side at a fixed ratio (`data-split`) or a list of links beside a detail pane (`data-list-detail`), switched by a container query; why there is no draggable divider | [`split.css`](https://domestic-ui.odonckers.dev/patterns/split.md), [`list-detail.css`](https://domestic-ui.odonckers.dev/patterns/list-detail.md) | [Split](https://domestic-ui.odonckers.dev/patterns/split.md) | None |
| [Search dialog](https://domestic-ui.odonckers.dev/explainers/search-dialog.md) | A command palette: a modal `<dialog>` holding a `<dui-combobox>` of pages and sections, opened from a Search button or with Cmd-K / Ctrl-K; when results load, how they map to options, and the shortcut | [`dialog.css`](https://domestic-ui.odonckers.dev/patterns/dialog.md), [`combobox.css`](https://domestic-ui.odonckers.dev/patterns/typeahead.md) | [Search dialog](https://domestic-ui.odonckers.dev/patterns/search-dialog.md) | [`dui-combobox.js`](https://github.com/odonckers/domestic-ui/blob/main/web-components/dui-combobox.js) plus page script |
| [Code highlighting](https://domestic-ui.odonckers.dev/explainers/code-highlighting.md) | `::highlight(dui-code-*)` names a page registers with the CSS Custom Highlight API, each colored by a `--dui-color-code-*` token at 4.5:1 on the code background | [`typography.css`](https://domestic-ui.odonckers.dev/components/base.md) | [Base elements](https://domestic-ui.odonckers.dev/components/base.md) | None (the page registers ranges) |
