Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rails-accessibility

БесплатноБез исполняемых скриптовНе проверен

Practical a11y patterns for Rails/Stimulus/Hotwire apps - ERB partials, axe-core CI, color contrast, modals, dynamic content. Not WCAG theory. Use when…

djc00pот djc00p165 установок в других каталогах

Об этом скилле

Rails Accessibility

Practical accessibility patterns for Rails 7+/8+ apps using Stimulus, Hotwire (Turbo), and Tailwind CSS. Not WCAG theory - actual ERB components, Stimulus controllers, and CI guardrails you drop in.

When to Use

  • Building or auditing a Rails app for accessibility
  • Setting up automated a11y checks in CI (axe-core + RSpec)
  • Implementing accessible forms, modals, navigation, or dynamic content
  • Fixing color contrast issues in Tailwind/oklch color systems
  • Adding screen-reader-friendly Turbo Frame / Turbo Stream interactions

Philosophy

Catch it in CI, not in production. The patterns here are useful, but the real win is the axe-core RSpec matcher that runs on every bin/rspec - same as any other test failure. If it's not in CI, it doesn't exist.

Patterns over gems. These ERB partials and Stimulus controllers are meant to be copied into your app and adapted to your design system. They're not a gem - they're a starting point. Your Tailwind config, error styling, and i18n setup will differ.

Test what users experience. System specs with driven_by(:selenium_headless) can catch real a11y issues that static analysis misses. The axe-core matcher runs in the browser, not on the server.

Quick Start

The axe-core + Capybara + system-spec setup in references/testing.md is the one file worth reading end to end on first use - it walks Gemfile additions, AxeHelper, Capybara driver config, the smoke test pattern, and the Devise sign-in gotcha.

Reference Docs

Each reference covers one task. Read the one that matches what you're building, not all six.

  • references/forms.md - Accessible form fields, error states, labels, Turbo gotchas
  • references/modals.md - Focus trap, aria-modal, role="dialog", ESC to close, Turbo Frame modal pattern
  • references/navigation.md - Skip links, landmark roles, current-page indicator, mobile menu, breadcrumbs
  • references/dynamic-content.md - aria-live, Turbo Frame/Stream announcements, flash messages, error summary focus
  • references/color-contrast.md - oklch chroma rules, Tailwind shades that fail AA, dark mode
  • references/testing.md - axe-core + RSpec + Capybara setup, smoke test pattern, per-rule skips, Devise sign-in gotcha

Examples

  • examples/modal_controller.js - Stimulus controller for accessible modals (the only standalone file worth keeping - drop straight into app/javascript/controllers/). The accessible field partial, skip link, and full axe system spec live as code blocks inside references/forms.md, references/navigation.md, and references/testing.md respectively, since they're tightly coupled to the surrounding explanation.

Common Gotchas

oklch chroma threshold

Tailwind's oklch color system can produce colors that look fine but fail WCAG AA. The full rule and the chroma-threshold table live in references/color-contrast.md; the one-line version: keep chroma <= 0.03 on text colors over light backgrounds. Above 0.04 almost certainly fails.

aria-expanded without role="combobox"

aria-expanded on an input signals a combobox pattern, but axe-core requires role="combobox" on the same element. Having aria-expanded alone is a WCAG violation.

Fix: Add role="combobox" to any input with aria-expanded.

Turbo Frame redirects break outside frame context

When a form inside <turbo-frame id="modal"> redirects to a URL outside the frame, Turbo generates broken GET /original-path/undefined requests. Two related rules:

  • Use data: { turbo: false } on forms that do full-page navigation (password changes, sign-out). Full pattern in references/modals.md.
  • data-turbo-frame overrides data-turbo="false" - if both are present, Turbo processes within the frame and ignores the opt-out. Full pattern in references/forms.md.

System spec sign_in failures in headless Chrome

Devise's sign_in test helper can silently fail in driven_by(:selenium_headless) - the session cookie doesn't transfer to the browser process. Use form-based sign-in (visit new_user_session_path; fill_in ...; click_button) instead. Full diagnosis in references/testing.md.

Accessibility specs break when page copy changes

Screen-reader UX specs and other a11y checks often assert on exact page titles, h1 text, or landmark labels. When you change i18n keys or marketing copy, those assertions fail even though the page is still accessible.

Example: a screen-reader UX spec asserts:

expect(page.title).to include("AI agents")
expect(page).to have_css("h1", text: /AI agents/i, visible: :all)

If the page title and h1 are changed to "AI assistants" / "Use your AI assistant.", the spec breaks with:

expected "AI assistants on Example · Example" to include "AI agents"

Procedure when changing public-page copy:

  1. Search for the old text in spec/system/ and spec/requests/:

    grep -R -n "old title text" spec/
    
  2. Update any screen-reader,

Полный SKILL.md на ClawHub

Установить rails-accessibility в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл rails-accessibility?

Practical a11y patterns for Rails/Stimulus/Hotwire apps - ERB partials, axe-core CI, color contrast, modals, dynamic content. Not WCAG theory. Use when: building or auditing accessible forms, modals, navigation, or live-updating content; setting up axe-core in CI or RSpec; fixing Tailwind/oklch contrast failures; making Turbo Frame/Stream updates announce to screen readers; or when an accessibility spec breaks because public-page copy changed.

Как установить скилл rails-accessibility?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rails-accessibility запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rails-accessibility с