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

form-labels

Skill này làm gì

Skill này kiểm tra các ô nhập form có nhãn rõ ràng và được liên kết hay không. Skill dành cho lập trình viên xây form mà nhiều người cần điền.

Khi nào nên dùng

  • ✓Khi một trường form chỉ có chữ gợi ý placeholder mà không có nhãn thật.
  • ✓Khi một nhóm checkbox hoặc radio button không có câu hỏi chung.
  • ✓Khi người dùng không thể bấm vào nhãn để focus ô nhập tương ứng.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/form-labels/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/form-labels/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 trường trên form của tôi có nhãn phù hợp không?”

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

Cách hoạt động

Agent xác minh mỗi ô nhập có một nhãn được liên kết bằng thuộc tính for và id. Agent thay các trường chỉ có placeholder bằng nhãn hiển thị và bọc các lựa chọn liên quan trong một fieldset có legend.

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.

Associate labels with form controls

Properly associated labels ensure that screen readers can identify the purpose of form inputs and increase the clickable area for users with motor impairments.

Quick Reference

  • Use <label> elements for all form inputs
  • Connect labels using for and id attributes
  • Placeholder text is not a label and must not be the only field name
  • Use <fieldset> and <legend> when multiple controls share one question
  • Ensure every input has a clear, accessible name

Check

Verify that all form controls (input, select, textarea) have programmatically associated labels using the 'for' and 'id' attributes. Flag placeholder-only labels and grouped controls that lack a fieldset legend.

Fix

Add a <label> element with a 'for' attribute that matches the 'id' of the corresponding input field. Replace placeholder-only labels with real label text and wrap related checkboxes or radio buttons in a <fieldset> with a <legend>.

Explain

Explain why associated labels are critical for screen reader users and how they improve the hit area for touch and mouse users.

Code Review

Review the rendered markup and interactive states that affect Associate labels with form controls. 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. Specifically check for placeholder-only labels and question groups that visually share a heading but lack a semantic <fieldset> and <legend>.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/accessibility/form-labels

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

Vì sao placeholder là chưa đủ?

Chữ placeholder biến mất khi người dùng bắt đầu gõ, và skill nói rằng nó không phải là một nhãn.

fieldset làm gì?

Nó nhóm các điều khiển liên quan, như nút radio, dưới một câu hỏi chung gọi là legend.

Vì sao nhãn giúp người dùng cảm ứng?

Nhãn được liên kết làm tăng vùng bấm được, điều này giúp người khó vận động.

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 Associate labels with form controls. 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
#2858
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ự