Linux 软件免费装
Banner图

Guardrail Blocks

开发者 breonwilliams
更新时间 2026年10月3日 03:23
PHP版本: 8.0 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

accessibility blocks wcag headings contrast

下载

0.1.0 0.1.1 0.1.2

详情介绍:

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

屏幕截图:

  • 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 Accessible Accordion on the front end: real buttons, correct ARIA, full keyboard support.

升级注意事项:

0.1.2 Accordion content now works without JavaScript, plus Table of Contents link, Button palette, and responsive image fixes. 0.1.1 Stronger heading-outline enforcement (now server-side on every render) plus new border, spacing, and font-size controls that follow your theme. 0.1.0 Initial release.

常见问题:

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.

更新日志:

0.1.2 0.1.1 0.1.0