focus-styles
Skill này làm gì
Skill này kiểm tra xem site có hiển thị viền rõ ràng khi người dùng bàn phím di chuyển giữa các điều khiển hay không. Skill dành cho lập trình viên và nhà thiết kế muốn kiểu dáng dễ tiếp cận.
Khi nào nên dùng
- ✓Khi CSS của bạn xóa viền mặc định của nút hoặc liên kết.
- ✓Khi người dùng bàn phím không thấy điều khiển nào đang được chọn.
- ✓Khi bạn thiết kế kiểu nút hoặc liên kết tùy chỉnh.
Liên kết skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-styles/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể đảm bảo các nút của tôi hiện viền rõ ràng khi tôi dù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 tìm trong các stylesheet những viền đã bị xóa và kiểm tra có viền thay thế hiển thị hay không. Agent gợi ý kiểu focus-visible với độ tương phản đủ và khoảng offset rõ rà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.
Provide visible custom focus indicators
Users who navigate by keyboard (people with motor disabilities, power users, people in assistive technology contexts) rely entirely on focus indicators to know where they are on the page. Removing outlines without replacement makes an entire site unusable for keyboard users. WCAG 2.4.7 requires a visible focus indicator, and WCAG 2.4.13 defines a stronger size-and-contrast target for custom indicators.
Quick Reference
- Never use outline: none or outline: 0 without a visible :focus-visible replacement
- Use :focus-visible instead of :focus to show indicators only during keyboard navigation
- Focus indicators must have 3:1 contrast ratio against adjacent colors (WCAG 2.2)
- Provide at least 2px solid outline with an offset for a high-quality focus ring
- If a focus ring is drawn with pseudo-elements, verify it is anchored to the correct positioned element and not clipped by
overflow: hidden - If the component uses a stretched-link pattern, verify the visible focus ring follows the actual interactive element rather than a parent wrapper by accident
Check
Find all instances of outline: none, outline: 0, or :focus { outline: none } in this CSS. Check if they provide an alternative visible focus indicator. If the replacement uses pseudo-elements, also verify the ring cannot be clipped or misplaced by overflow or missing positioning context.
Fix
Replace outline: none on :focus with :focus-visible styles that provide a clearly visible custom focus ring with appropriate contrast.
Explain
Explain the difference between :focus and :focus-visible, why focus styles matter for accessibility, and how to design an accessible focus ring.
Code Review
Review stylesheets, component styles, and responsive states related to Provide visible custom focus indicators. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/css/focus-styles
Câu hỏi thường gặp
Vì sao không xóa viền luôn?
Người dùng bàn phím phụ thuộc vào viền để biết mình đang ở đâu, nên xóa nó làm site khó dùng.
focus-visible là gì?
Đó là bộ chọn CSS chỉ hiển thị kiểu focus chủ yếu trong lúc điều hướng bằng bàn phím, không phải sau khi bấm chuột.
Cần độ tương phản bao nhiêu?
Skill nêu tỷ lệ tương phản 3 trên 1 so với các màu xung quanh cho chỉ báo focus.
Chi tiết
Mô tả gốc của tác giả
Use when reviewing stylesheets, component styles, and responsive behavior related to Provide visible custom focus indicators. Check the rendered layout across breakpoints and interaction states before proposing a fix.
Độ phổ biến
- Sao GitHub
- 75k
- Vị trí xếp hạng
- #2852
- Giấy phép
- MIT
- Cập nhật
- 31/10/2026
Bình luận
- …
Thêm skill từ kho mã này
frontendchecklist
75kKiểm tra mã frontend và trang trực tiếp theo hơn 380 quy tắc về khả năng tiếp cận, tốc độ, SEO và bảo mật, bằng một công cụ dòng lệnh.
frontend-checklist-global
75kKiểm toán một dự án frontend theo đủ 386 quy tắc của Front-End Checklist, và đưa cách sửa cụ thể cho từng vấn đề tìm thấy.
404-page
75kKiểm tra xem trang báo thiếu của bạn có đưa ra các liên kết hữu ích và trả về mã trạng thái 404 thật hay không, để giúp khách bị lạc tìm đường.
about-page
75kKiểm tra xem trang web có trang Giới thiệu rõ ràng giải thích ai điều hành nó hay không, để xây dựng niềm tin với khách và công cụ tìm kiếm.
Skill tương tự
canvas
394kCho phép agent của bạn hiện một widget trực quan được lưu trữ trên bảng Mac đã kết nối, rồi ẩn bảng hoặc chuyển nó sang trang khác.
control-ui
394kGiúp agent của bạn sắp xếp và khắc phục sự cố Control UI của OpenClaw, gồm các phiên, bảng điều khiển và Gateway đã kết nối.
diagram-maker
394kGiúp agent của bạn vẽ sơ đồ rõ ràng dạng SVG, HTML hoặc Excalidraw có thể sửa, cho quy trình, kiến trúc hệ thống và bản phác bảng trắng.