autofocus-avoidance
できること
このスキルは、ページの読み込み時に、予期せずフォームの項目にフォーカスが移らないかを確認します。他の内容の下にフォームがあるページを作る開発者向けです。
使う場面
- ✓見出しや導入文の下にある、autofocusのフォーム項目があるとき。
- ✓スクリーンリーダーの利用者が、ページの途中に送られたと報告したとき。
- ✓autofocusを使うサインインや検索のページをレビューしているとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/autofocus-avoidance/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“スクリーンリーダーの利用者が一番上から始められるように、私のサービスページのお問い合わせフォームからautofocusを取り除いてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、フォーム要素のautofocus属性を探して取り除きます。または、利用者が操作した後にだけ、JavaScriptでフォーカスを設定します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Avoid autofocus on form fields
Autofocus teleports screen reader users to mid-page without context—they miss everything before the form and have no idea where they landed.
Quick Reference
- Avoid autofocus on pages with content before the form
- Autofocus disrupts screen reader users who lose page context
- Use JavaScript focus after user interaction instead of page load
- Login and search-only pages are exceptions where autofocus may be acceptable
Check
Search for autofocus attributes on form elements. Verify that page load does not unexpectedly move focus away from the page top, especially on pages with content before the form.
Fix
Remove autofocus attributes from form elements. If focus management is needed, use JavaScript to set focus after user interaction rather than automatically on page load.
Explain
Explain how autofocus moves screen reader users to mid-page without context, can trigger unexpected scrolling, and disrupts users who were reading content before the focused element.
Code Review
Review the rendered markup and interactive states that affect Avoid autofocus on form fields. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/accessibility/autofocus-avoidance
よくある質問
autofocusは、なぜ問題ですか?
スクリーンリーダーの利用者はフォームより前の内容の文脈を失い、どこに移動したのか分からなくなると、このスキルは説明しています。
autofocusが問題ない場合はありますか?
はい。このスキルでは、サインインのページや検索だけのページは例外になりうると説明しています。
代わりにフォーカスはどう設定すべきですか?
利用者がページを操作した後に、JavaScriptで設定します。
詳細
作者による元の説明
Use when reviewing rendered HTML, interactive components, or design-system patterns related to Avoid autofocus on form fields. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.
人気
- GitHubのスター
- 75k
- ランキング
- #2750
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。