custom-element-accessibility
Skill này làm gì
Skill này kiểm tra các phần giao diện tự xây từ đầu, như nút hoặc ô nhập đặc biệt. Skill dành cho lập trình viên tự xây component web.
Khi nào nên dùng
- ✓Khi bạn đã xây một nút, menu hoặc ô nhập tùy chỉnh từ đầu.
- ✓Khi người dùng trình đọc màn hình không biết điều khiển tùy chỉnh làm gì.
- ✓Khi một ô nhập tùy chỉnh không hoạt động bên trong form web thông thường.
Liên kết skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/custom-element-accessibility/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ể kiểm tra xem widget tùy chỉnh của tôi có hoạt động với bàn phím và trình đọc màn hình không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent rà soát code widget để tìm nhãn ARIA còn thiếu, xử lý bàn phím và liên kết với form. Sau đó gợi ý bổ sung để widget hoạt động như một điều khiển gốc.
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 custom elements and Web Components accessible
Custom elements that lack ARIA reflection are invisible to screen readers — a button that looks correct visually may be announced as a generic "group" or not at all. ElementInternals provides the bridge between the shadow DOM and the accessibility tree, and it is also the only standards-compliant way to integrate custom inputs with native HTML forms.
Quick Reference
- Prefer native
<button>,<input>,<select>, and<details>before building a custom widget - Use ElementInternals.ariaRole to expose ARIA semantics from the shadow DOM
- Implement form-associated custom elements with ElementInternals for native form participation
- Apply roving tabindex for compound widgets (listbox, toolbar, menu)
- The shadow DOM does not automatically expose ARIA to the accessibility tree without ElementInternals
Check
Inspect these custom element definitions for missing ElementInternals setup, absent ARIA reflection, incomplete keyboard interaction patterns, and lack of form association for input-like components. First verify that the widget truly needs to be custom rather than a native control with styling.
Fix
Add ElementInternals attachment in the constructor, implement ariaRole and ariaLabel reflection, add keyboard event handlers following ARIA authoring patterns, and use formAssociated for custom input elements. Replace the component with native HTML when the native control already supports the required interaction.
Explain
Explain why the shadow DOM does not automatically expose ARIA semantics and how ElementInternals bridges the gap between custom elements and the accessibility tree.
Code Review
Review custom element class files for ElementInternals attachment, ARIA property reflection, keyboard interaction (Tab, Enter, Space, Arrow keys), focus management, and formAssociated static property on input-like elements. Flag cases where a native control would remove the accessibility burden entirely.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/html/custom-element-accessibility
Câu hỏi thường gặp
Có nên tự xây điều khiển tùy chỉnh không?
Trước hết skill gợi ý kiểm tra xem một điều khiển HTML chuẩn đã được tạo kiểu có làm được việc không. Điều khiển tùy chỉnh chỉ là phương án cuối cùng.
ElementInternals là gì?
Đó là tính năng trình duyệt cho phép component tùy chỉnh chia sẻ ý nghĩa và dữ liệu form với trang. Skill khuyên dùng nó.
Skill kiểm tra những phần nào của widget?
Skill xem role và nhãn ARIA, tương tác bàn phím, và liên kết với form đối với các phần giống ô nhập.
Chi tiết
Mô tả gốc của tác giả
Use when reviewing custom element class definitions or Web Component source code to check for missing ARIA reflection, keyboard handling, and form association.
Độ phổ biến
- Sao GitHub
- 75k
- Vị trí xếp hạng
- #2806
- 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ự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.