本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2750

autofocus-avoidance

できること

このスキルは、ページの読み込み時に、予期せずフォームの項目にフォーカスが移らないかを確認します。他の内容の下にフォームがあるページを作る開発者向けです。

使う場面

  • ✓見出しや導入文の下にある、autofocusのフォーム項目があるとき。
  • ✓スクリーンリーダーの利用者が、ページの途中に送られたと報告したとき。
  • ✓autofocusを使うサインインや検索のページをレビューしているとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/autofocus-avoidance/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/autofocus-avoidance/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

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.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2750
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル