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

keyboard-navigation

Skill này làm gì

Skill này kiểm tra mọi phần tương tác của trang có hoạt động với phím Tab không và focus có di chuyển theo thứ tự hợp lý không. Skill dành cho lập trình viên và nhà thiết kế muốn website dễ tiếp cận.

Khi nào nên dùng

  • ✓Khi một nút hoặc liên kết không thể tới bằng phím Tab.
  • ✓Khi phần tử ẩn vẫn có thể nhận focus bàn phím.
  • ✓Khi người dùng bàn phím bị kẹt trong một phần của trang.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/keyboard-navigation/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/keyboard-navigation/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 mọi điều khiển trên website của tôi có hoạt động chỉ bằng bàn phím không?”

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

Cách hoạt động

Agent kiểm tra thứ tự Tab, xác nhận các phần tử ẩn bị loại khỏi focus và tìm chỗ bẫy. Agent gợi ý sửa thứ tự DOM và thiết lập tabindex khi cầ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.

Enable keyboard navigation for all elements

15% of users rely on keyboard navigation—broken focus order or keyboard traps make your site completely unusable for them.

Quick Reference

  • All interactive elements must be reachable via Tab key
  • Focus order should follow visual reading order (left-to-right, top-to-bottom)
  • Never use positive tabindex values—they break natural flow
  • Hidden content must be removed from tab sequence with tabindex='-1'
  • Keyboard traps are only acceptable inside active modals with a working Escape path

Check

Test that all interactive elements are keyboard accessible, focus order matches visual/reading order, hidden content is not focusable, and no keyboard traps exist except in modals with proper escape handling.

Fix

Ensure tab order follows DOM order matching visual layout. Use tabindex='-1' to remove hidden elements from focus. Avoid positive tabindex values. Ensure off-screen or display:none content cannot receive focus.

Explain

Explain how logical focus order helps keyboard users navigate efficiently, why hidden elements must be removed from the tab sequence to avoid confusion, and how focus management affects users of screen readers and switch devices.

Code Review

Review the rendered markup and interactive states that affect Enable keyboard navigation for all elements. 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/keyboard-navigation

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

Vì sao truy cập bằng bàn phím quan trọng?

Skill nói nhiều người dựa vào bàn phím, gồm người khuyết tật vận động và người dùng trình đọc màn hình.

Khi nào bẫy bàn phím được chấp nhận?

Skill nói chỉ được có bên trong một modal đang mở và có đường thoát Escape hoạt động.

Có nên dùng giá trị tabindex dương không?

Skill nói không nên, vì giá trị dương làm hỏng luồng tự nhiên.

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 Enable keyboard navigation for all elements. 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
#2908
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ự