Skip to content

Checks

What fails a build, and how to fix it. Errors stop the build; warnings don't.

Reading a diagnostic

✗ src/index.html:4  fg:text on bg:accent — contrast 2.2:1, needs 4.5:1 → try fg:on-accent

The file and line, what's wrong, and after → a fix. ✗ is an error, ! a warning. In the Vite dev server the same messages appear in the browser overlay, and in your editor as you type.

With --json, each diagnostic has a rule: config, color-ref, syntax, contrast, tap-target, forms, names, lang, headings, links, media, menus, dialogs or css. See Tools.

The config

✗ kerf.config.js  unknown palette "nuetral" in "nuetral.650" → try neutral.600
✗ kerf.config.js  "brand.650": 650 is not a palette step → try brand.600
✗ kerf.config.js  text.steps must include "base"

The config is checked first. A colour role must be a palette step (brand.600), white or black; scales, breakpoint names and component recipes must be valid. These have no line number. A colour reference that can't be read stops everything else, since there's no system to check pages against, so fix it first.

Scales and words

✗ src/index.html:2  pad 13 — not in space scale → nearest: 12 or 16
✗ src/index.html:3  unknown "buton" → try button

Spacing, widths and text sizes must come from their scales; colours must be roles. Typos get the nearest word Kerf knows, and CSS words get Kerf's: align top suggests align start.

Contrast

✗ src/index.html:5  fg:text-muted on bg:accent — contrast 1.3:1, needs 4.5:1 → try fg:on-accent

Checked in markup against the background each element actually sits on, and in the config for every role pairing and component state, in light and dark mode. See Colour and contrast.

Content inside prose isn't known until it arrives, so Kerf checks the colours it will use, its quotes and captions in text-muted and its links in text-link, on the background the container sits on.

Hover

✗ src/index.html:4  hover: fg:text on bg:accent — contrast 2.2:1, needs 4.5:1 → try hover:on-accent
✗ src/index.html:5  when its parent is hovered: fg:text-link on bg:accent — contrast 1.3:1, needs 4.5:1 → try a lighter hover background on the parent, e.g. hover:bg-surface-raised
✗ src/index.html:8  hover:pad — hover: changes colours, corners and shadows only (fg, bg, border, border-t, border-b, round, shadow): size and position would make the page jump under the pointer
! src/index.html:9  hover:border-accent does nothing: it changes the colour of a border, and this element has none → try border-border hover:border-accent

Hover colours are checked like any others, in light and dark mode: an element's own hover text and background, and the text of everything inside it that sits on its hover background, such as a link in a table row. An element with its own background isn't affected by its parent's hover.

Tap targets

✗ kerf.config.js  chip — tap target 27.2px tall, needs 44px → try pad-y 16

Components with interactive: true (see Config) must be at least rules.tapTarget pixels tall (44 by default, WCAG 2.5.5), measured at their phone text size from the padding, any border and the line height. Form fields, links in a <nav> and <summary> are made that tall automatically.

Forms

✗ src/index.html:8  <input type="email"> has no label (a placeholder isn't a label: it disappears as you type) → try <label> around it, or an id and <label for>
! src/index.html:11  <input> is aria-invalid but doesn't say why → try aria-describedby="<id of the error message>"

Every field needs a name a screen reader can announce: a <label> around it, <label for>, aria-label, aria-labelledby or title.

Names, language and headings

✗ src/index.html:3  <img> has no alt → try alt="what it shows", or alt="" if it's decoration
✗ src/index.html:9  link to /cart has no name (a screen reader would read out the address) → try text in it (visually-hidden if it shows only an icon), alt on its image, or aria-label
✗ src/index.html:1  <html> has no lang: screen readers would guess the language → try <html lang="en">
! src/index.html:14  <h4> after <h2> skips a level → try <h3>, and s="…" for its size
  • Images need alt: what the image shows, or alt="" for decoration. role="presentation" and aria-hidden="true" count as decoration.
  • Links and buttons need a name: text in them (visually-hidden text counts), the alt of an image in them, an <svg> with a <title>, aria-label, aria-labelledby or title. An icon with alt="" alone isn't one.
  • A link in a sentence keeps its underline: no-underline on a link inside a <p> is an error, since colour alone doesn't mark it as a link (WCAG 1.4.1). Links that stand on their own, like cards, can drop it.
  • A page's <html> needs lang.
  • disabled on a link is an error: links have no disabled state, so it still works. Leave out href and add aria-disabled="true", or use a <button disabled>.
  • Headings shouldn't skip a level, and a page should start at <h1>; this is a warning. Pick the level for the outline and the size with s=. Components and partials can start at any level.
  • Template code and components can supply a name, so Kerf doesn't guess: <a href="/">{label}</a> passes.

Dialogs

✗ src/index.html:8  <dialog> has no name: a screen reader announces it when it opens → try aria-labelledby="its heading's id"
! src/index.html:8  <dialog> has no close button: Escape works, but touch and mouse users need one → try <form method="dialog"><button>Close</button></form>

A dialog needs aria-label or aria-labelledby. A close button is a <form method="dialog">, a button with formmethod="dialog", or one with command="close" or "request-close"; one closed by your own script is a warning you can ignore. See Dialogs.

Images

✗ src/index.html:6  <img> has no width or height: the page jumps when it loads → try width="…" height="…" (the file's size in px; s="ratio …" to show it in another shape)
! src/index.html:6  cover without ratio does nothing: the image keeps its own shape → try ratio 16:9 cover
! src/index.html:9  cover on <div> does nothing: it fits an image or video into its box → try cover on the <img> or <video> itself

An <img> without width and height is an error: the browser can't keep its space before it loads, so the page jumps, which Google measures as layout shift (CLS). Use the file's own size; s="ratio …" shows it in another shape, and CSS keeps it no wider than its container. Images with hidden are skipped, and template code can supply the size. cover and contain without ratio, or on an element that isn't an image or video, are warnings: they would change nothing. See Images and video.

Your own CSS

! src/site.css:12  padding: 13px — 13px not in space scale → try var(--k-space-12) or var(--k-space-16)

Spacing, font sizes and colours in your own .css files are checked against the system: warnings unless rules.css is "error". See Your own CSS.

Breakpoints and layout

✗ src/index.html:7  md:bg-accent — colours can't change by breakpoint (contrast is checked once per element)
  • Colours, components, hover:, prose and menu can't take a breakpoint.
  • A property can't be set twice at the same breakpoint (pad 8 pad 16).
  • One component per element.
  • show on a stack, row, grid or center would undo its layout: repeat the layout at the breakpoint instead.

Templates

✗ views/card.blade.php:1  s= can't contain template code: Kerf reads it at build time → try fixed words in s=; k- classes in class for what changes at runtime

See Templates. Layouts and includes are checked as they're expanded, and problems point at the file and line that has them:

✗ src/about.html:1  _partials/heder.html — file not found in the input folder
✗ src/about.html:3  <kerf-include> needs src="…", a path in the input folder → try <kerf-include src="_partials/header.html">
✗ src/_partials/nav.html:1  _partials/nav.html includes itself (index.html → _partials/nav.html → _partials/nav.html)