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

decorative-elements

Skill này làm gì

Skill này kiểm tra các ảnh và biểu tượng trang trí trên trang, và đảm bảo trình đọc màn hình bỏ qua chúng. Skill dành cho lập trình viên xây website dễ tiếp cận.

Khi nào nên dùng

  • ✓Khi trình đọc màn hình đọc tên ảnh vô nghĩa trên trang của bạn.
  • ✓Khi bạn thêm đường kẻ, biểu tượng hoặc ảnh nền trang trí.
  • ✓Khi bạn rà soát trang về khả năng truy cập trước khi ra mắt.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/decorative-elements/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/decorative-elements/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ể đảm bảo các biểu tượng trang trí trên trang của tôi được ẩn khỏi 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 kiểm tra ảnh trang trí có alt rỗng và biểu tượng trang trí được ẩn bằng một thuộc tính đơn giản. Nó cũng không gắn cờ các thành phần trang trí vô hại như là vấ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.

Hide decorative elements from assistive technology

Screen readers announce every image and icon—decorative elements clutter the experience with meaningless 'image, decorative border, image, bullet' announcements.

Quick Reference

  • Use alt='' (empty) for decorative images—not alt='image' or missing alt
  • Add aria-hidden='true' to decorative SVGs and icons
  • Use CSS background-image for purely decorative visuals
  • Role='presentation' removes semantic meaning from elements
  • Do not automatically raise performance findings on decorative micro-assets unless the snippet shows real layout instability
  • Example safe pattern: <img src="/divider.svg" alt="" aria-hidden="true"> is usually a decorative no-op, not a finding by itself

Check

Verify decorative images have empty alt attributes (alt=''), decorative icons use aria-hidden='true', and background images used for decoration are not announced by screen readers. Do not report decorative images as accessibility or performance failures unless the code shows a concrete problem rather than a hypothetical optimization.

Fix

Add alt='' to decorative img elements. Add aria-hidden='true' to decorative SVGs and icon fonts. Use CSS background-image for purely decorative visuals instead of img elements.

Explain

Explain how screen readers announce every image and element unless explicitly hidden, and why decorative content clutters the experience for users navigating with assistive technology.

Code Review

Review the rendered markup and interactive states that affect Hide decorative elements from assistive technology. 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/decorative-elements

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

Alt rỗng là gì?

Đó là thuộc tính alt không có chữ nào, báo cho trình đọc màn hình bỏ qua ảnh. Nó phù hợp với ảnh chỉ mang tính trang trí.

Có nên ẩn mọi biểu tượng không?

Chỉ ẩn các biểu tượng trang trí. Skill dành cho các phần tử trang trí, còn ảnh có ý nghĩa cần có mô tả bằng văn bản.

Ảnh trang trí nhỏ có bị báo là chậm không?

Skill nói không, trừ khi code cho thấy một vấn đề bố cục thật sự.

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 Hide decorative elements from assistive technology. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant. If an image is clearly decorative, default to no finding unless the snippet shows an actual issue such as broken semantics, focusability, or visible layout instability.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2811
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ự