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

focus-management

できること

このスキルは、ウィンドウが開いたり、閉じたり、更新されたりしたときに、キーボードのフォーカスがどこに移るかを確認します。モーダル、メニュー、シングルページアプリを作る開発者向けです。

使う場面

  • ✓ポップアップが開いても、キーボードのフォーカスが後ろに残るとき。
  • ✓ダイアログを閉じた後、フォーカスが予期しない場所に移るとき。
  • ✓シングルページアプリで画面が変わり、キーボードの利用者が迷子になるとき。

スキルのリンク

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

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“モーダルを開いたり閉じたりしたときに、キーボードのフォーカスが正しく移るようにしてもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、開いたときと閉じたときのフォーカスの移動と、モーダルの中にフォーカスが留まるかを確認します。開いたときはダイアログの中にフォーカスを移し、閉じたときは開いたトリガーにフォーカスを戻すことを提案します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Manage focus during dynamic interactions

Poor focus management leaves keyboard users stranded—they can't find new content, get trapped in closed modals, or lose their place entirely after interactions.

Quick Reference

  • Move focus to modal when opened, return to trigger when closed
  • Focus new content after SPA navigation or dynamic updates
  • Use tabindex='-1' to make non-interactive elements focusable
  • Never lose focus to an unexpected location

Check

Verify that focus is properly managed when opening/closing modals, navigating between views, or updating content dynamically.

Fix

Implement proper focus management using tabindex, focus(), and focus trapping for modal dialogs.

Explain

Explain how proper focus management ensures keyboard and screen reader users can navigate dynamic interfaces effectively.

Code Review

Review the rendered markup and interactive states that affect Manage focus during dynamic interactions. 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/focus-management

よくある質問

モーダルが開いたとき、フォーカスはどこに行くべきですか?

モーダルの中に移し、モーダルが閉じたら、それを開いたボタンに戻すことを提案します。

フォーカストラップとは何ですか?

ダイアログが閉じられるまで、キーボードのフォーカスをその中に留め、利用者が隠れたページの内容に入らないようにするものです。

tabindex -1 は何をしますか?

通常のタブ順には入れずに、コードからだけ非インタラクティブな要素にフォーカスできるようにします。

詳細

作者による元の説明

Use when reviewing rendered HTML, interactive components, or design-system patterns related to Manage focus during dynamic interactions. 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
ランキング
#2849
ライセンス
MIT
更新日
2026/10/31

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

0

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

コメント

  • …

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

似ているスキル