frontend-a11y
できること
Webサイトやアプリを、障害のある人を含むすべての人が使いやすくするための手助けをします。ボタンやフォーム、その他の要素がスクリーンリーダーやキーボード操作で正しく機能するようにします。
使う場面
- ✓Webサイトのフォームを作るとき。
- ✓インタラクティブなボタンやメニューを追加するとき。
- ✓コードでアクセシビリティの警告を受け取ったとき。
スキルのリンク
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/frontend-a11y/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ログインフォームを、視覚に障害のあるユーザーにも使いやすくするにはどうすればよいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、スクリーンリーダーがページの要素を理解して操作できるよう、'htmlFor'や'aria-label'などの具体的なコードを追加します。また、それぞれの機能に適したHTMLタグの使用も提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Frontend Accessibility Patterns
Practical accessibility patterns for React and Next.js. Covers the issues most commonly flagged in code review: missing form labels, incorrect ARIA usage, non-semantic interactive elements, and broken keyboard navigation.
When to Activate
- Building or reviewing form components (
<input>,<select>,<textarea>) - Creating interactive elements (modals, dropdowns, tooltips, tabs)
- Using
<div>or<span>withonClick - Adding
aria-*attributes to any element - Implementing keyboard navigation or focus management
- Receiving accessibility feedback from code review tools (CodeRabbit, ESLint a11y)
- Building components that must support screen readers
Form Accessibility
Missing htmlFor / id pairing and disconnected error messages are the most common issues flagged in code review.
Label Connection
// BAD: label has no connection to input — screen readers cannot associate them
<label>Email</label>
<input type="email" />
// GOOD: htmlFor matches input id
<label htmlFor="email">Email</label>
<input id="email" type="email" />
Required Fields
// BAD: visual-only asterisk conveys nothing to screen readers
<label htmlFor="email">Email *</label>
<input id="email" type="email" />
// GOOD: required enables native browser validation; aria-required signals it to screen readers
<label htmlFor="email">
Email <span aria-hidden="true">*</span>
</label>
<input id="email" type="email" required aria-required="true" />
Error Messages
// BAD: error text exists visually but is not linked to the input
<input id="email" type="email" />
<span className="error">Invalid email address</span>
// GOOD: aria-describedby connects input to its error message
// aria-invalid signals the invalid state to screen readers
<input
id="email"
type="email"
aria-describedby="email-error"
aria-invalid={!!error}
/>
{error && (
<span id="email-error" role="alert">
{error}
</span>
)}
Complete Accessible Form
interface LoginFormProps {
onSubmit: (email: string, password: string) => void;
}
export function LoginForm({ onSubmit }: LoginFormProps) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [errors, setErrors] = useState<{ email?: string; password?: string }>({});
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
const newErrors: typeof errors = {};
if (!email) newErrors.email = 'Email is required';
if (!password) newErrors.password = 'Password is required';
if (Object.keys(newErrors).length) {
setErrors(newErrors);
return;
}
onSubmit(email, password);
};
return (
<form onSubmit={handleSubmit} noValidate>
<div>
<label htmlFor="email">
Email <span aria-hidden="true">*</span>
</label>
<input
id="email"
type="email"
value={email}
onChange={e => setEmail(e.target.value)}
aria-required="true"
aria-describedby={errors.email ? 'email-error' : undefined}
aria-invalid={!!errors.email}
autoComplete="email"
/>
{errors.email && (
<span id="email-error" role="alert">
{errors.email}
</span>
)}
</div>
<div>
<label htmlFor="password">
Password <span aria-hidden="true">*</span>
</label>
<input
id="password"
type="password"
value={password}
onChange={e => setPassword(e.target.value)}
aria-required="true"
aria-describedby={errors.password ? 'password-error' : undefined}
aria-invalid={!!errors.password}
autoComplete="current-password"
/>
{errors.password && (
<span id="password-error" role="alert">
{errors.password}
</span>
)}
</div>
<button type="submit">Log in</button>
</form>
);
}
Semantic HTML
Use the element that matches the intent. Screen readers and keyboard users depend on native semantics.
// BAD: div has no role, no keyboard support, no accessible name
<div onClick={handleClick}>Submit</div>
// GOOD: button is focusable, activates on Enter/Space, announces as "button"
<button type="button" onClick={handleClick}>Submit</button>
// BAD: non-semantic navigation
<div onClick={() => navigate('/home')}>Home</div>
…
よくある質問
「スクリーンリーダー」とは何ですか?
画面の内容を音声で読み上げるプログラムです。視覚に障害のある人がパソコンやスマホを使う助けになります。
なぜ 'aria-label' や 'htmlFor' を使うのですか?
これらは、ラベルをフォーム項目やボタンと結びつけるためのコードで、スクリーンリーダーが要素の正しい目的を読み上げられるようにします。
'onClick' を付けた 'div' はいつ使うべきですか?
基本的には使うべきではありません。キーボードでの操作などの機能がもともと備わっている <button> タグを使う方がよいです。
詳細
作者による元の説明
Accessibility patterns for React and Next.js — semantic HTML, ARIA attributes, form labeling, keyboard navigation, focus management, and screen reader support. Use when building or reviewing forms, modals, dropdowns, tooltips, or tabs, fixing a11y lint or code-review findings, or wiring up keyboard navigation and focus management.
repo: affaan-m/ECC
人気
- GitHubのスター
- 280k
- ランキング
- #182
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
accessibility
280kエージェントが誰にとっても使いやすいインターフェースを作れるように手助けします。目が見えない方や身体の動きに制限のある方など、障害のある人にとってもWebサイトやアプリが正しく動くようにします。
agent-architecture-audit
280kエージェントがすべて正しく動いているかを確認できるようにします。AIシステムの問題を見つけて修正し、期待どおりに動くようにします。
agent-eval
280kエージェントが異なるAIコーディングツールを比較できるようにします。特定のタスクにおいて、どれがより速く、安く、信頼性が高いかを測定します。
agent-harness-construction
280kエージェントがタスクの進め方をよりよく理解できるようにします。エージェントが使うツールや指示を最適化し、成功する可能性を高めます。
似ているスキル
dream-loop
260kコンセプトアートと比べながら、ライブのスクリーンショットを繰り返し確認して、3Dのシーンやビジュアルアプリを高いグラフィック品質に近づけるようエージェントを支援します。
pretext
260kテキストが動く図形の周りに回り込んだり、ゲームのレベルを形作ったり、粒子になって崩れたりする、遊び心のあるブラウザのデモを作るようエージェントを支援します。
page-agent
260kウェブアプリに組み込みのAIアシスタントを加え、利用者が平易な言葉で命令し、ページがそれを実行できるようにするのを、エージェントが支援します。