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

---

Search plugins

![](https://ps.w.org/guardrail-blocks/assets/banner-772x250.png?rev=3725373)

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

# Guardrail Blocks

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

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

 * [Details](https://li.wordpress.org/plugins/guardrail-blocks/#description)
 * [Reviews](https://li.wordpress.org/plugins/guardrail-blocks/#reviews)
 * [Development](https://li.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 (plus any custom colors added in Global Styles), 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.

## Screenshots

[⌊The Starter Brochure Page pattern: hero, feature cards, FAQ, and call-to-action
with a guaranteed-valid heading outline.⌉⌊The Starter Brochure Page pattern: hero,
feature cards, FAQ, and call-to-action with a guaranteed-valid heading outline.⌉[

The Starter Brochure Page pattern: hero, feature cards, FAQ, and call-to-action 
with a guaranteed-valid heading outline.

[⌊Contrast enforcement in the editor: pick a background from the theme palette and
the readable text color is chosen automatically, with the live WCAG ratio shown.⌉⌊
Contrast enforcement in the editor: pick a background from the theme palette and
the readable text color is chosen automatically, with the live WCAG ratio shown.⌉[

Contrast enforcement in the editor: pick a background from the theme palette and
the readable text color is chosen automatically, with the live WCAG ratio shown.

[⌊The Outline Checker panel lists every heading — including core Heading blocks —
and flags outline problems.⌉⌊The Outline Checker panel lists every heading — including
core Heading blocks — and flags outline problems.⌉[

The Outline Checker panel lists every heading — including core Heading blocks — 
and flags outline problems.

[⌊The Accessible Accordion on the front end: real buttons, correct ARIA, full keyboard
support.⌉⌊The Accessible Accordion on the front end: real buttons, correct ARIA,
full keyboard support.⌉[

The Accessible Accordion on the front end: real buttons, correct ARIA, full keyboard
support.

## Blocks

This plugin provides 10 blocks.

 *   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.
 *   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.
 *   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.
 *   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.
 *   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.
 *   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.

## 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.2

 * Fixed: Accordion content is now reachable without JavaScript, as documented. 
   WordPress’s server-side processing of Interactivity API directives was rendering
   every panel hidden; panels are now open in the page markup and collapse when 
   the script loads, without a layout shift. Collapsed panels can be found with 
   the browser’s find-in-page where supported, which opens them.
 * Fixed: Table of Contents links now point to the right heading when several posts
   render on one page (for example a blog index that shows full posts).
 * Fixed: Table of Contents now links core Heading blocks whose HTML anchor was 
   saved by an earlier WordPress version.
 * Fixed: the Accessible Button’s color picker kept only Global Styles custom colors
   once any were added, hiding the theme palette. Theme and custom colors are now
   offered together, and when a custom color overrides a theme color, that is the
   color the contrast check uses.
 * Improved: Media Figure’s `sizes` attribute now follows the block’s alignment 
   and the theme’s content/wide widths, so wide and full-width images no longer 
   load undersized files.
 * Editor: the Accordion Item header and Media Figure no longer trigger an accessibility
   warning or a deprecation notice in the editor.
 * Tested up to WordPress 7.1.

#### 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.2**
 *  Last updated **2 days ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 6.9 or higher **
 *  Tested up to **7.1.2**
 *  PHP version ** 8.0 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/guardrail-blocks/)
 * Tags
 * [accessibility](https://li.wordpress.org/plugins/tags/accessibility/)[blocks](https://li.wordpress.org/plugins/tags/blocks/)
   [contrast](https://li.wordpress.org/plugins/tags/contrast/)[headings](https://li.wordpress.org/plugins/tags/headings/)
   [wcag](https://li.wordpress.org/plugins/tags/wcag/)
 *  [Advanced View](https://li.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/)