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

aria-hidden-focus

Skill này làm gì

Skill này tìm các phần tử có thể focus nằm trong vùng bị ẩn. Nó dành cho lập trình viên ẩn bảng điều khiển hoặc menu và cần focus bàn phím hoạt động đúng.

Khi nào nên dùng

  • ✓Khi một bảng bị ẩn bằng aria-hidden nhưng liên kết hoặc nút trong đó vẫn có thể được tab tới.
  • ✓Khi người dùng bàn phím báo focus biến mất vào khoảng không.
  • ✓Khi bạn xem lại nội dung được thu gọn hoặc nằm ngoài màn hình.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-hidden-focus/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/aria-hidden-focus/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

“Menu bên của tôi bị ẩn bằng aria-hidden nhưng người dùng vẫn tab vào được. Sửa lỗi đó.”

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

Cách hoạt động

Agent tìm các phần tử con có thể focus bên trong vùng aria-hidden, rồi hoặc đặt tabindex thành -1 cho chúng, hoặc dùng thuộc tính inert để chặn chú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.

Remove focusable elements from aria-hidden containers

When a keyboard user tabs into an aria-hidden element, the screen reader remains silent, leaving the user with no idea where their focus is or what they can interact with.

Quick Reference

  • Elements with aria-hidden="true" must not contain focusable children
  • Focusing on a hidden element creates a 'ghost' focus for screen reader users
  • Use tabindex="-1" or inert to properly hide interactive elements

Check

Scan aria-hidden="true" containers for focusable elements like links, buttons, or inputs.

Fix

Add tabindex="-1" to focusable children inside aria-hidden containers or use the inert attribute.

Explain

Explain why focusable elements inside aria-hidden containers cause confusion for keyboard and screen reader users.

Code Review

Review the rendered markup and interactive states that affect Remove focusable elements from aria-hidden containers. 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/aria-hidden-focus

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

Điều gì xảy ra khi focus rơi vào phần tử bị ẩn?

Skill nói người dùng trình đọc màn hình không nghe gì, nên họ không biết mình đang ở đâu.

Thuộc tính inert là gì?

Đó là thuộc tính HTML giữ một vùng ngoài focus bàn phím, và skill đưa ra như một lựa chọn.

Skill liệt kê những cách sửa nào?

Nó liệt kê cả tabindex đặt thành -1 và thuộc tính inert để ẩn các phần tử tương tác.

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 Remove focusable elements from aria-hidden containers. 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
#2728
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ự