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

modal-accessibility

Skill này làm gì

Skill này kiểm tra các hộp thoại modal có vai trò, nhãn và hành vi bàn phím đúng hay không. Skill dành cho lập trình viên front end muốn các cửa sổ bật lên mà mọi người đều dùng được.

Khi nào nên dùng

  • ✓Khi bạn nhờ agent xem lại một cửa sổ bật lên hoặc modal về khả năng truy cập.
  • ✓Khi người dùng bàn phím bị kẹt trong hộp thoại hoặc không đóng được nó.
  • ✓Khi bạn đang xây một component hộp thoại mới và muốn nó theo các quy tắc truy cập cơ bản.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/modal-accessibility/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/modal-accessibility/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ể kiểm tra các cửa sổ bật lên của tôi để đảm bảo người dùng bàn phím mở, dùng và đóng được không?”

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

Cách hoạt động

Agent kiểm tra hộp thoại có đúng vai trò và nhãn ARIA, giữ phím Tab bên trong, đóng bằng phím Escape và trả tiêu điểm về phần tử đã mở nó.

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.

Make modal dialogs keyboard accessible

Without proper focus trapping and keyboard handling, modal dialogs are invisible traps for keyboard users—they can't navigate, can't escape, and can't complete tasks.

Quick Reference

  • Use role='dialog' and aria-modal='true' on the modal container
  • Trap focus inside the modal—Tab should cycle within modal only
  • Close on Escape key press and return focus to trigger element
  • Add aria-labelledby pointing to the modal title

Check

Verify modals have proper ARIA roles, focus trapping, keyboard dismissal (Escape), and return focus on close.

Fix

Implement accessible modals using role='dialog', aria-modal='true', focus trapping, and proper keyboard handling.

Explain

Explain the accessibility requirements for modal dialogs including focus management, ARIA attributes, and keyboard interaction.

Code Review

Review the rendered markup and interactive states that affect Make modal dialogs keyboard accessible. 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/modal-accessibility

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

Hộp thoại nên có vai trò gì?

Skill khuyên dùng role dialog với aria-modal đặt thành true trên vùng chứa.

Vì sao phải trả tiêu điểm sau khi đóng?

Điều đó cho phép người dùng bàn phím tiếp tục từ chỗ họ đang ở, thay vì mất vị trí trên trang.

Hộp thoại có cần tiêu đề không?

Có. Skill gợi ý dùng aria-labelledby để trỏ tới tiêu đề của modal.

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 Make modal dialogs keyboard accessible. 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
#2942
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ự