Title: Guardrail Blocks
Author: BreonWilliams
Published: <strong>July 13, 2026</strong>
Last modified: July 13, 2026

---

Search plugins

![](https://ps.w.org/guardrail-blocks/assets/icon.svg?rev=3606405)

# Guardrail Blocks

 By [BreonWilliams](https://profiles.wordpress.org/breonwilliams/)

[Download](https://downloads.wordpress.org/plugin/guardrail-blocks.0.1.1.zip)

 * [Details](https://wordpress.org/plugins/guardrail-blocks/#description)
 * [Reviews](https://wordpress.org/plugins/guardrail-blocks/#reviews)
 * [Development](https://wordpress.org/plugins/guardrail-blocks/#developers)

 [Support](https://wordpress.org/support/plugin/guardrail-blocks/)

## Description

Most accessibility failures on WordPress sites are authoring failures: a brand color
that doesn’t meet WCAG contrast, a heading hierarchy scrambled by reordering, an
accordion built from divs with no keyboard support. They look fine in the editor
and fail the audit later.

Guardrail Blocks takes a different approach: instead of _offering_ accessible options,
its blocks make the failure impossible to author — and re-verify everything on every
page view.

#### The guarantees

 * **WCAG-safe color contrast** — Button backgrounds come only from your theme’s
   palette, and the most readable text color is chosen automatically (the live ratio
   is shown in the sidebar, e.g. “Contrast 8.36:1 — AA ✓”). The pairing is re-validated
   server-side on every page view against your theme’s _current_ palette, so switching
   themes or changing brand colors can never leave a failing button behind.
 * **Unbreakable heading hierarchy** — There is no heading level control anywhere.
   An Accessible Heading derives its level (H2–H6) from how Accessible Sections 
   are nested, and re-derives it when you reorder, nest, or un-nest — the document
   outline stays valid by construction. Card titles and accordion headers participate
   too, always one level below their section’s heading.
 * **Correct interactive semantics** — The Accordion ships the full WAI-ARIA disclosure
   pattern: real buttons inside correctly-leveled headings, `aria-expanded`/`aria-
   controls` wiring, Enter/Space toggling, arrow-key navigation between headers,
   and content that stays reachable without JavaScript.
 * **Performance-correct media** — The Media Figure renders through core’s responsive-
   image pipeline with explicit dimensions (no layout shift), `srcset`/`sizes`, 
   a hero toggle for `fetchpriority="high"` (better LCP) vs. lazy loading, and alt
   text enforcement with editor warnings.

#### The blocks

Accessible Section, Accessible Heading, Accessible Button, Card + Card Grid, Accessible
Accordion, Notice (info/success/warning/error with correct ARIA roles), Media Figure,
and a Table of Contents that is generated from the page’s real outline on every 
view — it can never go stale.

#### Safety nets

 * The **Outline Checker** panel (in the page sidebar) watches the whole document—
   including core Heading blocks — and flags skipped levels and extra H1s with one-
   click block selection.
 * Everything inherits your theme’s colors, spacing, and typography via `theme.json`.
   Nothing fights your design.
 * The plugin makes **zero external requests** and collects no data.

#### Source code & development

The compiled block scripts in `build/` are generated with @wordpress/scripts (webpack).
The complete, human-readable source code is included with this plugin in the `src/`
directory (TypeScript and SCSS, one folder per block). To rebuild `build/` from 
it: `npm install && npm run build` (Node 22; `package.json` and `tsconfig.json` 
are included).

Development happens publicly at https://github.com/breonwilliams/guardrail-blocks,
which also carries the full test suite (Jest, PHPUnit, Playwright) and CI.

## Blocks

This plugin provides 10 blocks.

 *   Accessible Heading A heading whose level (H2–H6) is set automatically from 
   where it sits in your section structure. You write the words; the correct level
   is guaranteed — even after reordering.
 *   Media Figure An image with performance-correct markup guaranteed: responsive
   sizes, explicit dimensions (no layout shift), smart loading priority, and enforced
   alt text.
 *   Notice A callout with the correct semantic role built in — info, success, warning,
   or error — announced properly by screen readers and never relying on color alone.
 *   Table of Contents A table of contents generated from the page's real heading
   outline on every view — reorder your sections and it stays correct, automatically.
 *   Accessible Button A call-to-action button whose colors are always WCAG-safe:
   pick a background from your theme palette and the most readable text color is
   chosen for you — re-checked on every page view.
 *   Card Grid A responsive grid of cards. Columns adapt to the available space 
   automatically — no breakpoints to configure, nothing to break.
 *   Accessible Section A content section that manages heading structure for you:
   any Accessible Heading inside renders at the correct level based on how sections
   are nested — reordering can never break your document outline.
 *   Accessible Accordion Expandable content panels with correct disclosure semantics
   and full keyboard support built in — Enter/Space to toggle, arrow keys to move
   between headers, screen-reader announcements for free.
 *   Card One card in a Card Grid. Its title is an Accessible Heading, so card titles
   automatically join the page outline at the correct level.
 *   Accordion Item One expandable panel inside an Accessible Accordion. The header
   is a real button inside a correctly-leveled heading; the panel is a labeled region.

## FAQ

### Does this replace core blocks?

No. It’s a focused set that mixes freely with core blocks — use core paragraphs,
images, and columns as usual. The Outline Checker even watches headings you author
with the core Heading block.

### What happens to an uncolored button?

It inherits your theme’s own button styling (the same `wp-element-button` mechanism
core’s Button uses), so it always looks like a button. The contrast guarantee applies
the moment you pick a palette background; the theme-default state’s contrast is 
the theme’s responsibility, exactly as with core buttons.

### My theme defines palette colors as CSS variables — does the contrast check work?

Yes. Palettes in the `var(--name, #hex)` format used by many popular themes are 
fully supported. A color whose value genuinely can’t be resolved (for example `color-
mix(...)`) is not offered for buttons rather than being silently unchecked, and 
the sidebar explains why.

### Why can’t I pick a heading level?

That’s the point: hand-picked levels are how outlines break. The level always derives
from section nesting, so reordering can never skip a level or create a second H1.
If you need a specific level, nest (or un-nest) the section — the outline follows
the structure.

### What happens if I deactivate the plugin?

Static content (sections, cards, notices’ inner content) remains as clean HTML. 
Dynamic blocks (headings, buttons, accordions, table of contents) stop rendering
their markup but your content is preserved and reappears on reactivation — nothing
is lost.

### Does it phone home?

No. Zero external HTTP requests, no tracking, no accounts.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Guardrail Blocks” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ BreonWilliams ](https://profiles.wordpress.org/breonwilliams/)

[Translate “Guardrail Blocks” into your language.](https://translate.wordpress.org/projects/wp-plugins/guardrail-blocks)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/guardrail-blocks/),
check out the [SVN repository](https://plugins.svn.wordpress.org/guardrail-blocks/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/guardrail-blocks/)
by [RSS](https://plugins.trac.wordpress.org/log/guardrail-blocks/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 0.1.1

 * Heading levels are now also derived from the block tree’s actual nesting on every
   render, so a stored level can never produce a wrong heading — the outline guarantee
   is enforced server-side end to end.
 * New theme-friendly design controls via core block supports: border on Card and
   Accordion; border radius on Button and Media Figure (rounds the image); padding
   on Accordion; font size on Accordion, Notice, and Table of Contents; margin on
   Accessible Heading.
 * Fixed: the Button’s border radius now previews live in the editor with themes
   that style `wp-element-button` (Blocksy and similar).

#### 0.1.0

 * Initial release.
 * Blocks: Accessible Section, Accessible Heading, Accessible Button, Card + Card
   Grid, Accessible Accordion, Notice, Media Figure, Table of Contents.
 * Contrast engine (editor + server) with support for hex, rgb(), and var()-fallback
   theme palettes.
 * Heading levels derived from section nesting with self-correction on reorder; 
   Outline Checker panel.
 * Accordion built on the WordPress Interactivity API with the WAI-ARIA disclosure
   pattern.
 * Five patterns including the Starter Brochure Page.

## Meta

 *  Version **0.1.1**
 *  Last updated **8 hours ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 6.9 or higher **
 *  Tested up to **7.0.1**
 *  PHP version ** 8.0 or higher **
 * Tags
 * [accessibility](https://wordpress.org/plugins/tags/accessibility/)[blocks](https://wordpress.org/plugins/tags/blocks/)
   [contrast](https://wordpress.org/plugins/tags/contrast/)[headings](https://wordpress.org/plugins/tags/headings/)
   [wcag](https://wordpress.org/plugins/tags/wcag/)
 *  [Advanced View](https://wordpress.org/plugins/guardrail-blocks/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/guardrail-blocks/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/guardrail-blocks/reviews/)

## Contributors

 *   [ BreonWilliams ](https://profiles.wordpress.org/breonwilliams/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/guardrail-blocks/)