Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2849

focus-management

Skill này làm gì

Skill này kiểm tra focus bàn phím di chuyển đến đâu khi các cửa sổ mở, đóng hoặc cập nhật trên trang. Skill dành cho lập trình viên xây modal, menu và single-page app.

Khi nào nên dùng

  • ✓Khi một cửa sổ bật lên mở ra nhưng focus bàn phím vẫn ở phía sau nó.
  • ✓Khi đóng một hộp thoại làm focus rơi vào vị trí không mong đợi.
  • ✓Khi một single-page app đổi màn hình và người dùng bàn phím bị lạc.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-management/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể đảm bảo focus bàn phím di chuyển đúng khi modal của tôi mở và đóng không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra cách focus di chuyển khi mở và đóng, và liệu nó có ở lại trong modal không. Agent gợi ý đưa focus vào hộp thoại, giữ focus ở đó và trả lại cho nút đã mở khi đóng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

Focus nên đến đâu khi modal mở?

Skill gợi ý đưa focus vào trong modal, rồi trở lại nút đã mở nó khi modal đóng.

Focus trap là gì?

Đó là việc giữ focus bàn phím bên trong hộp thoại cho đến khi nó được đóng, để người dùng không Tab vào nội dung trang đang ẩn.

tabindex -1 làm gì?

Skill nói nó cho phép phần tử không tương tác nhận focus từ mã, mà không nằm trong thứ tự Tab thông thường.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2849
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự