Accessibility — WCAG 2.2 in v2.0.0
Skeletonic Stylus v2.0.0 ships WCAG 2.2 conformance as the default behaviour, not as an optional theme. This page documents what's baked in and what mixins you can opt into for finer control.
What you get for free
| WCAG 2.2 SC | What v2.0.0 does | How to verify |
|---|---|---|
| 1.4.3 Contrast (Minimum) — AA | <code>--cl-primary</code> and <code>--cl-secondary</code> darkened to ≥ 4.5:1 against white | DevTools → contrast checker |
| 1.4.11 Non-text Contrast — AA | Form borders, buttons, badges all ≥ 3:1 | Same |
| 2.4.7 Focus Visible — AA | Every focusable element has a <code>:focus-visible</code> ring (yellow on dark backgrounds, blue on light) | <code>Tab</code> through any page |
| 2.4.11 Focus Not Obscured — AA (new in 2.2) | Sticky header has reduced height + focus scroll-margin | <code>Tab</code> past the sticky header |
| 2.5.8 Target Size — AA (new in 2.2) | Buttons / links: ≥ 24×24 CSS px hit area | DevTools box model |
| 1.4.12 Text Spacing — AA | All elements honour user line-height / letter-spacing overrides | Override in DevTools |
| 2.3.3 Animation from Interactions — AAA | All animation classes are wrapped in <code>@media (prefers-reduced-motion: no-preference)</code> | OS-level reduce-motion |
| 1.4.10 Reflow — AA | Layout works at 320 px without horizontal scroll | DevTools narrow viewport |
| Dark mode | <code>prefers-color-scheme: dark</code> swaps tokens automatically | OS dark-mode toggle |
| RTL & logical properties (3.1.2 / 1.4.10) | All directional CSS uses <code>margin-inline-*</code>, <code>padding-inline-*</code>, <code>border-inline-*</code>, <code>inset-inline-*</code>, <code>text-align: start/end</code>. Sidebars, link reveals, code-block accent stripes flip on <code><html dir="rtl"></code> | <code><html dir="rtl"></code> toggle |
| <code>forced-colors: active</code> (Windows HCM) | Every focus rule has a <code>CanvasText</code> outline fallback. No content disappears in HCM | Edge → Settings → High Contrast |
Stylus mixins you can opt into
If you compile from source, the following mixins are available in <code>src/stylus/utilities/mixins.styl</code>:
| Mixin | Use |
|---|---|
| <code>focus-ring()</code> | High-contrast focus ring honouring <code>:focus-visible</code> |
| <code>visually-hidden()</code> | Screen-reader-only text that stays focusable |
| <code>skip-link()</code> | Anchor that becomes visible on focus |
| <code>reduced-motion()</code> | Wraps any block in <code>prefers-reduced-motion: no-preference</code> |
| <code>forced-colors()</code> | Adjustments for Windows High Contrast Mode |
| <code>target-size(24px)</code> | Pads any clickable to a minimum tap target |
Example:
<code class="language-stylus">// Apply a strong focus ring on a custom button .my-button focus-ring() target-size(28px) </code></pre>
The skip-link helper
Drop this first thing inside <code><body></code>:
<code class="language-html">Skip to main content </code></pre>The class is not in the core stylesheet (so the page weight doesn't budge); it's a 4-line snippet you compose yourself or use the included <code>skip-link()</code> mixin. This site uses it — focus the page and press Tab to see it appear in the top-left.
RTL out of the box
Set <code>dir="rtl"</code> on <code><html></code> (or any subtree) and the inline axis flips without you adding a single line of CSS:
<code class="language-html"> … تخطي إلى المحتوى … </code></pre>What flips automatically: paddings, margins, borders, alignment of forms and tables, the off-canvas hamburger sidebar in <code>components/navbar.styl</code>, and the 12 <code>.link-1</code>…<code>.link-12</code> underline reveals (these explicitly preserve their "from-start" / "from-end" semantics under RTL via a <code>[dir="rtl"]</code> override block in <code>elements/link-effects.styl</code>). What doesn't flip: <code><code></code> and <code>
</code> blocks, which keep <code>direction: ltr</code> because code is conventionally left-to-right.
Themable headings via <code>--gr-h1</code>…<code>--gr-h6</code>
v2.0.0 wires the <code>
</code>–<code>
</code> rules to runtime CSS custom properties so you can retheme typography without recompiling Stylus. The defaults follow a 1.27 (minor third) ratio:
<code class="language-css">} </code></pre>Override on any ancestor:
<code class="language-css">} </code></pre>Line heights follow the same pattern: <code>--gr-lh-h1</code> … <code>--gr-lh-h6</code>.
Verifying your own pages
The library ships an <code>a11y-test.mjs</code> script under <code>scripts/</code> that runs axe-core against every URL you give it.
<code class="language-bash"> </code></pre>CI runs this script against the <code>dist/index.html</code> showcase page on every push.