Documentation
¶
Overview ¶
Package a11y is the no-browser accessibility checker run over every golden page and partial: structural rules on the HTML (names, landmarks, ids, headings, tables, dialogs, CSP-hostile attributes) plus contrast and CSS lint on the tokens. It cannot replace a screen-reader pass (docs/QA.md has the by-hand checklist) but it fails the build on the mistakes machines can see.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DeclaredPairs = []Pair{
{"--color-sumi", "--color-paper", 4.5, "text on surface"},
{"--color-sumi", "--color-shiro", 4.5, "text on page"},
{"--color-sumi-soft", "--color-paper", 4.5, "body text on surface"},
{"--color-sumi-soft", "--color-kasumi", 4.5, "body text on hover"},
{"--color-hai", "--color-paper", 4.5, "muted text on surface"},
{"--color-hai", "--color-shiro", 4.5, "muted text on page"},
{"--color-hai", "--color-kasumi", 4.5, "muted text on hover/fill"},
{"--color-accent", "--color-paper", 4.5, "link on surface"},
{"--color-accent", "--color-shiro", 4.5, "link on page"},
{"--color-accent", "--color-accent-soft", 4.5, "accent on accent-soft"},
{"--color-success", "--color-success-soft", 4.5, "success text"},
{"--color-warning", "--color-warning-soft", 4.5, "warning text"},
{"--color-danger", "--color-danger-soft", 4.5, "danger text"},
{"--color-danger", "--color-paper", 4.5, "danger text on surface"},
{"--color-paper", "--color-sumi", 4.5, "primary button text"},
{"--color-paper", "--color-danger", 4.5, "danger button text"},
{"--color-paper", "--color-sumi-soft", 4.5, "primary button hover text"},
{"--color-accent", "--color-paper", 3, "focus ring on surface"},
{"--color-accent", "--color-shiro", 3, "focus ring on page"},
{"--border-control", "--color-paper", 3, "control border on surface"},
{"--border-control", "--color-shiro", 3, "control border on page"},
{"--chart-1", "--color-paper", 3, "chart series 1 on surface"},
{"--chart-2", "--color-paper", 3, "chart series 2 on surface"},
{"--chart-3", "--color-paper", 3, "chart series 3 on surface"},
{"--chart-4", "--color-paper", 3, "chart series 4 on surface"},
{"--chart-5", "--color-paper", 3, "chart series 5 on surface"},
{"--chart-6", "--color-paper", 3, "chart series 6 on surface"},
{"--color-brand", "--color-paper", 3, "brand mark on surface"},
{"--color-brand", "--color-shiro", 3, "brand mark on page"},
{"--color-sumi", "--color-accent-soft", 4.5, "bulk bar text"},
{"--color-sumi", "--color-kasumi", 4.5, "active nav text"},
{"--color-success", "--color-paper", 4.5, "success text on surface"},
{"--color-warning", "--color-paper", 4.5, "warning text on surface"},
{"--color-success", "--color-shiro", 4.5, "success text on page"},
{"--color-warning", "--color-shiro", 4.5, "warning text on page"},
{"--color-danger", "--color-shiro", 4.5, "danger text on page"},
{"--color-sumi-soft", "--color-shiro", 4.5, "nav text on sidebar"},
{"--color-sumi", "--color-kasumi", 4.5, "table head on hover"},
{"--color-sumi", "--chart-bar-soft", 4.5, "bar list name on its bar"},
{"--color-sumi", "--chart-bar-quiet", 4.5, "quiet bar list name on its bar"},
}
DeclaredPairs are the combinations the partials actually use.
Functions ¶
func CheckPublicWidgets ¶
CheckPublicWidgets lints a public page-builder fragment (the inside of <main>, island applied or not). Fragment mode: no document rules. errs fail a build; warns are advice (heading order, header-less table). Canvas output is not meant for it.
func ContrastIssues ¶
ContrastIssues checks every declared pair in both themes.
Types ¶
type Options ¶
type Options struct{ Page bool }
Options selects the rule set: Page applies document-level rules (one h1, lang, title, landmarks, skip link) that make no sense for a fragment.
type Pair ¶
Pair is a foreground/background token pair and the minimum ratio: 4.5 for text, 3 for UI boundaries and focus rings (WCAG 2.2 1.4.3 / 1.4.11).
type Tokens ¶
Tokens are the custom properties of one theme, resolved (var() followed).
func ParseTokens ¶
ParseTokens reads tokens.css into the light and dark token sets (dark inherits whatever it does not override, as the cascade does).