Command Palette

Search for a command to run...

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

building-accessible-interfaces

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

Use when building or auditing any web UI for accessibility — keyboard navigation, screen readers, focus management, ARIA, color contrast, form labels and…

osmonteroот osmontero★ 18 звёзд на GitHub

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

Building Accessible Interfaces

Overview

Accessibility is not a pass applied at the end. Almost every accessibility defect is a structural decision — a div that should have been a button, a state communicated only in color, a modal that never moved focus — and structural decisions are expensive to reverse.

Core principle: Native semantic HTML is accessible by default. Every layer you add on top of it is a layer you now own the accessibility of.

Target: WCAG 2.2 Level AA.

The Iron Law

NO CUSTOM CONTROL WHERE A NATIVE ELEMENT EXISTS

A <div onclick> needs a role, a tabindex, key handlers for Enter and Space, a focus style, and a disabled state. A <button> needs none of that — it arrives with all of it, correct on every platform and assistive technology, for free.

Wrote <div onclick>? Replace it with <button>. Do not add ARIA to make the div behave like a button — ARIA changes what assistive tech announces, never what the browser does.

Checklist

  1. Semantics first — correct elements, landmarks, heading order
  2. Keyboard — everything operable, visible focus, logical order, no traps
  3. Names — every control and image has an accessible name
  4. Contrast — text 4.5:1, large text and UI boundaries 3:1
  5. Forms — labels, error association, announcement
  6. Dynamic content — live regions for anything that changes without navigation
  7. Motion and targets — reduced-motion respected, targets ≥ 24px (44px recommended)
  8. Verify — automated scan, then a keyboard walk, then a screen reader

1. Semantics

Use the Right Element

Need Element Never
Navigates to a URL <a href> <button onclick=location…>
Performs an action <button> <div onclick>, <a href="#">
Group of options, one choice <input type="radio"> styled divs
Show/hide content <details><summary> div + JS toggle
Modal dialog <dialog> div with position: fixed
Selection from a list <select> custom listbox, unless genuinely required
Tabular data <table> with <th scope> grid of divs
Progress <progress> animated div

The <a> vs <button> distinction is not cosmetic: links support open-in-new-tab, copy-link, and activate on Enter only; buttons activate on Enter and Space. Screen-reader users navigate by element type, so a "button" in the links list is genuinely misleading.

Landmarks

Exactly one <main>. Wrap navigation in <nav>. Use <header>, <footer>, <aside>. Screen-reader users jump between landmarks constantly; a page of nested divs offers nothing to jump to.

<a href="#main" class="skip-link">Skip to content</a>
<header>…</header>
<nav aria-label="Primary">…</nav>
<main id="main" tabindex="-1">…</main>
<footer>…</footer>

Multiple <nav> elements each need a distinguishing aria-label ("Primary", "Breadcrumb", "Pagination").

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: var(--space-s); top: var(--space-s); z-index: 9999; }

Headings

One <h1> per page. Never skip levels (h2 → h4 is a defect). Heading level communicates document structure — pick it for structure and set the size with CSS.

2. Keyboard

Every interactive element must be reachable and operable by keyboard alone. This is the highest-yield check in this document and it takes ninety seconds: unplug the mouse and Tab through the page.

Key Expected
Tab / Shift+Tab Move between focusable elements in DOM order
Enter Activate link or button
Space Activate button, toggle checkbox, scroll page
Esc Close modal, popover, menu; cancel the current interaction
Arrows Move within a composite widget — radio group, tabs, menu, listbox
Home / End First / last item in a composite widget

Roving tabindex — a composite widget is one tab stop, with arrows moving inside it:

// Only the active item is tabbable; arrows move the active item.
items.forEach((el, i) => el.tabIndex = i === active ? 0 : -1);

Tabs, menus, toolbars, and listboxes all use this. A tab list where every tab is a separate tab stop is incorrect.

Focus Visibility

:focus-visible {
  outline: 2px solid var(--focus, currentColor);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }  /* no ring on mouse click */

Never outline: none without a replacement. The focus indicator must have 3:1 contrast against adjacent colors and be at least 2px thick (WCAG 2.2 SC 2.4.11/2.4.13).

Focus Management

Focus must move when context changes, and return when it closes.

// Opening
lastFocused = document.activeElement;
dialog.showModal();                    // <dialog> traps focus natively
dialog.querySelector('h2').focus();    // or the first meaningful control

// Closing
dialog.close();
lastFocused?.focus();                  // MUST re
Полный SKILL.md на GitHub

Установить building-accessible-interfaces в Claude Code и Claude Desktop

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

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

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

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

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

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

FAQ

Что делает скилл building-accessible-interfaces?

Use when building or auditing any web UI for accessibility — keyboard navigation, screen readers, focus management, ARIA, color contrast, form labels and error announcements, reduced motion, or touch target size. Triggers include "is this accessible", "WCAG", "a11y", "screen reader", "keyboard navigation", "focus trap", "contrast ratio", "aria-label", or building modals, menus, tabs, comboboxes, toasts, and custom controls that must work without a mouse.

Как установить скилл building-accessible-interfaces?

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

Скилл building-accessible-interfaces запускает скрипты?

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

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

Сравнить building-accessible-interfaces с