A command that checks a view snapshot against a profile ledger. CI passes a profile id and an exception file. It does not restate the rules.
People who run visual checks in a product pipeline, and people who add a profile for a new device class, use this ledger instead of copying thresholds into each host.
Table of Contents
The command is a Dub executable. If DMD is not on PATH, pass --compiler=ldc2.
dub build --compiler=ldc2view-check --profile mobile-web --snapshot layout.json --exceptions view.kdl--profiles points at the ledger directory. It defaults to profiles in the working directory.
A rendered snapshot that breaks text-edge-inset exits 1. The same snapshot with a waiver for that node exits 0. examples/host.ps1 is that host.
| Flag | Use |
|---|---|
|
The ledger profile: |
|
One snapshot, or every |
|
A waiver file. Repeat it to layer built-in, site, and bridged waivers. |
|
|
|
Report |
|
Fail when an active waiver cleared nothing. |
|
|
|
Also write the JSON report to a file. |
|
Drop the |
Exit codes: 0 pass, 1 a blocking finding (or a stale waiver with --fail-on-stale), 2 a usage, ledger, snapshot, or waiver error.
Each rule in the ledger has a tier. A waiver clears any tier.
| Tier | Text label | Fails CI | Rules |
|---|---|---|---|
|
|
Yes |
|
|
|
Yes |
|
|
|
With |
|
|
|
Never. Shown with |
|
text-edge-inset is standard on a rendered snapshot and quality on a source snapshot (source="quality"). An older ledger line with severity="error" reads as broken, and severity="warning" as quality. rendered= and source= take a tier or one of those words.
Colours are computed in D. The command parses #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), and common colour names, and paints a translucent foreground over its background first.
-
contrast-aa: WCAG 2.1 contrast. Text needs 4.5:1, large text 3:1 (24px, or 18.66px at weight 700, orisLargeText). A control boundary or an icon on a fill needs 3:1. Nodes axe reported are left toaxe-contrast. -
contrast-margin: APCA-W3 0.0.98G-4g. A pair that passes AA still needs |Lc| 60 for text, 45 for large text, and 30 for non-text. -
axe-contrast: each axecolor-contrasthit inaxeHits, or inaxe. -
focus-visible: the strongest of outline, box-shadow, and border against the background needs 3:1. No indicator fails.outlineStyle: autopasses. -
link-not-distinct: a link without an underline needs 3:1 against the body text around it. -
near-identical-colors: two colours closer than OKLab ΔEmax(0.02) where they should read apart. -
token-pair-drift: token pairs. Text needs 4.5:1,nonTextandboundary3:1. -
hover-unchanged,hard-coded-color: fromhoverChecksandcolorPairs. -
color-scheme-dual:declaredSchemeshaslightanddark. Skipped when the snapshot has nodeclaredSchemes. -
theme-toggle:hasHeaderThemeToggle(orthemeTogglePresent) is not false. -
target-comfort: 44px for primary mobile controls. When any node setsprimary, only those are checked. -
phone-header-single-row,auth-tabbed-switcher,footer-nav-hierarchy: readux.singleRowPhoneHeader,ux.tabbedAuthSwitcher, andux.footerHierarchy.ipad-webexcludes the phone header rule.
A contrast finding carries fg, bg, ratio, apcaLc, and suggestedFg: the nearest colour of the same hue that reaches the floor.
exceptions {
waive "contrast-*" id="skittles-novelty" scheme="skittles" reason="Skittles is an opt-in novelty theme."
waive "*" id="legacy-light" mode="light" state="default" reason="Migration guard: light mode is in the backlog."
waive "contrast-aa" page="docs/**" fg="#999" bg="#fff" expires="2027-03-01" reason="Muted grey goes in the next paint."
}The first argument is a rule id, a glob such as contrast-, or . reason is required. The rest are optional:
| Attribute | Match |
|---|---|
|
Names the waiver in the report. Defaults to |
|
Exact, |
|
A glob on the snapshot |
|
|
|
|
|
A colour, compared as normalized hex. Only findings with that colour match. |
|
|
An active waiver that clears nothing is listed as stale. --fail-on-stale fails the run on it.
ignoreRules on a node (data-view-check-ignore) and a top-level inlineIgnores list (data-contrast-check-ignore) also clear findings. Both are listed under exempted with inline:SELECTOR as the waiver id.
--format json and --json PATH write:
-
findings[]:tier,severity,rule,page,snapshot,scheme,mode,state,selector,node,fg,bg,ratio,required,apcaLc,suggestedFg,detail,message,blocks. -
exempted[]:waiverId,rule,page,snapshot,scheme,mode,state,selector,reason,expires. -
staleWaivers[],expiredWaivers[]:waiverId,rule,reason,expires. -
summary: counts forbroken,standard,quality,advisory,blocking,exempted,staleWaivers,expiredWaivers,pagesChecked, andpagesFailed[].
A missing value is null. schema is view-check/report@1. pass is false when the exit code is 1.
The ledger is KDL. A child accounts for every parent rule id by inheriting it, overriding it, or excluding it with a reason. A child does not restate language. An exception file is a per-view waiver. It is not the ledger’s excludes section.
target-min follows WCAG 2.2 SC 2.5.8 (AA). A control passes at 24 x 24px, or when a 24px circle on its centre clears every other control. Inline links in prose are exempt. Axe target-size hits are reported too. 44pt (Apple) and 48dp (Material) are comfort targets for primary mobile controls, not this rule.
Check a folder of snapshots at once. Pages of one class are then compared for content-width:
view-check --profile web --snapshot-dir snapshots/desktopA node needs id, role, x, and width. These fields are optional:
| Field | Use |
|---|---|
|
Page position, for spacing and card rows. |
|
Hidden and screen-reader-only nodes leave a rule and are counted in a |
|
From |
|
For |
|
For |
|
An ancestor clips the box, or the box sits in a sideways scroller. |
|
For |
|
For |
|
For |
|
For |
|
|
|
Colours for |
|
For |
|
|
|
|
|
A primary control, for |
x and width default to 0, so a colour-only node needs just id and role.
A snapshot can also carry scrollWidth, clientWidth, canScrollX, h1Count, hasMenuTrigger, and pageClass.
A snapshot can also carry these. All are optional, so older snapshots still load.
| Field | Use |
|---|---|
|
Where the capture came from: |
|
|
|
The schemes the paint declares, for |
|
Either name, for |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A snapshot can carry bars and breakpoints for header-breakpoint-gap. A bar has id, width, requiredWidth, activeMinWidth, activeMaxWidth, and breaks (overflow or wrap). A breakpoint has px, feature, edge, header, and media.
A layout rule from a wide view can stop working before the next media query takes over. header-breakpoint-gap catches that from one snapshot.
-
The adapter finds each single-row header bar: the outermost
display: flex,flex-wrap: nowraprow in the header with two or more visible children. -
It shrinks that bar under the rules active now until a child overflows the bar, a control leaves it, or a child wraps. Fixed padding, borders, and the scrollbar gutter are added. The result is
requiredWidth, a window width. -
It reads every
@mediawidth in the stylesheets, including range syntax andem. Theedgeof a breakpoint is the narrowest pixel of the layout on its wider side:max-width: 860pxhas edge 861, andmin-width: 900pxhas edge 900. Cross-origin sheets are skipped. -
activeMinWidthis the nearest header edge at or below the window width. With no narrower header breakpoint, the rule’smin(320px) is the floor. -
The rule fails when
requiredWidthis more thanactiveMinWidth, and names the band:header requires ~1003px but stays in this layout down to 861px: dead zone 861-1002px.
The reference adapter also snapshots those edges, so the narrowest pixel of each layout is tested as a real view. PROBES=all (the default) probes every @media edge from 320px to 1600px. PROBES=header probes only media rules that style the header. PROBES=none keeps the fixed matrix. WIDTHS= adds desktop widths.
The fixed matrix is 360 and 390 (phones, mobile/, check with mobile-web), 768, 834, and 1024 (tablets, tablet/, check with ipad-web), and 1280 (desktop/, check with web). Probes under 600px are phones; the rest are desktop windows.
Set data-view-check-page on the page container. Container rules depend on it.
| Class | Aliases | Container rule |
|---|---|---|
|
|
None. Bands may be full-bleed. |
|
|
A centred column inside the header edges. |
|
|
A centred column. |
|
|
None. Panes may run edge to edge. |
|
|
Fills the header width, or a centred column inside it. |
content-width compares pages of the same class at the same view width. An unannotated page gets only the basic checks. text-edge-inset, overflow-x, clipped-offscreen, and target-min apply to every class.
examples/playwright/ is a reference adapter that writes these snapshots with Playwright.
See CHANGELOG.adoc.