focus-styles
できること
このスキルは、キーボードの利用者がコントロールの間を移動するとき、サイトに見えるアウトラインが表示されているかを確認します。アクセシブルなスタイルを作るデザイナーや開発者向けです。
使う場面
- ✓CSS でボタンやリンクの既定のアウトラインを消しているとき。
- ✓キーボードの利用者が、どのコントロールが選ばれているか見えないとき。
- ✓独自のボタンやリンクのスタイルをデザインするとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-styles/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“キーボードを使うと、ボタンに見えるアウトラインが表示されるようにしてもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、スタイルシートの中でアウトラインが消されている箇所を探し、代わりに見える表示があるかを確認します。十分なコントラストと明確なオフセットを持つ focus-visible のスタイルを提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Provide visible custom focus indicators
Users who navigate by keyboard (people with motor disabilities, power users, people in assistive technology contexts) rely entirely on focus indicators to know where they are on the page. Removing outlines without replacement makes an entire site unusable for keyboard users. WCAG 2.4.7 requires a visible focus indicator, and WCAG 2.4.13 defines a stronger size-and-contrast target for custom indicators.
Quick Reference
- Never use outline: none or outline: 0 without a visible :focus-visible replacement
- Use :focus-visible instead of :focus to show indicators only during keyboard navigation
- Focus indicators must have 3:1 contrast ratio against adjacent colors (WCAG 2.2)
- Provide at least 2px solid outline with an offset for a high-quality focus ring
- If a focus ring is drawn with pseudo-elements, verify it is anchored to the correct positioned element and not clipped by
overflow: hidden - If the component uses a stretched-link pattern, verify the visible focus ring follows the actual interactive element rather than a parent wrapper by accident
Check
Find all instances of outline: none, outline: 0, or :focus { outline: none } in this CSS. Check if they provide an alternative visible focus indicator. If the replacement uses pseudo-elements, also verify the ring cannot be clipped or misplaced by overflow or missing positioning context.
Fix
Replace outline: none on :focus with :focus-visible styles that provide a clearly visible custom focus ring with appropriate contrast.
Explain
Explain the difference between :focus and :focus-visible, why focus styles matter for accessibility, and how to design an accessible focus ring.
Code Review
Review stylesheets, component styles, and responsive states related to Provide visible custom focus indicators. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/css/focus-styles
よくある質問
アウトラインを消してしまえばよいのではないですか?
キーボードの利用者は、アウトラインで現在位置を知るため、消すとサイトが使いにくくなるからです。
focus-visible とは何ですか?
マウスでクリックした後ではなく、主にキーボードで移動しているときにフォーカスのスタイルを表示する CSS のセレクターです。
どのくらいのコントラストが必要ですか?
フォーカスの表示は、周囲の色に対して3対1のコントラスト比が必要だとこのスキルは挙げています。
詳細
作者による元の説明
Use when reviewing stylesheets, component styles, and responsive behavior related to Provide visible custom focus indicators. Check the rendered layout across breakpoints and interaction states before proposing a fix.
人気
- GitHubのスター
- 75k
- ランキング
- #2852
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
canvas
394k接続されたMacのパネルにホスト型のビジュアルウィジェットを表示し、そのパネルを隠したり別のページに移動したりするようエージェントを支援します。
control-ui
394kセッション、ダッシュボード、接続されたGatewayを含め、OpenClaw Control UIを整理し、問題を解決するようエージェントを支援します。
diagram-maker
394kプロセス、システムのアーキテクチャ、ホワイトボードのスケッチのために、SVG、HTML、または編集可能なExcalidrawとして、分かりやすい図を作るようエージェントを支援します。