跳到正文
Skillpedia
网站与界面(前端)75k · #2738

aria-text

它能做什么

这项技能检查 role=text 容器是否在屏幕阅读器面前隐藏了其中可获得焦点的项目。适合在包装元素上设置 role=text 的开发者。

适用场景

  • ✓当带有 role=text 的卡片或包装元素中包含链接或按钮时。
  • ✓当屏幕阅读器跳过某个区块内的控件时。
  • ✓当你审查在容器上设置 role=text 的组件时。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-text/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-text/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请检查我网站上是否有 role=text 的包装元素包含访客无法触达的按钮或链接。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会查找带有可聚焦子元素的 role=text 元素,然后删除该角色,或把可交互项目移到容器之外。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Avoid focusable descendants in role="text" elements

Using role="text" on a container forces screen readers to treat everything inside as a single string of text, which effectively hides any interactive elements from users who rely on assistive technology.

Quick Reference

  • Elements with role="text" should not contain interactive children (links, buttons)
  • Ensure role="text" only contains static text content
  • Prevent accessibility "black holes" where interactive items are hidden from screen readers

Check

Identify elements with role="text" and verify they do not contain any focusable elements like buttons, links, or inputs.

Fix

Remove role="text" from containers that have interactive children or move the interactive elements outside.

Explain

Explain how role="text" overrides the semantics of descendant elements, making interactive components inaccessible to screen reader users.

Code Review

Review the rendered markup and interactive states that affect Avoid focusable descendants in role="text" 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/aria-text

常见问题

role=text 为什么会造成问题?

这项技能说明,它会让其中的所有内容被读成一整段文字,从而对屏幕阅读器用户隐藏可交互的部分。

修复方法是什么?

从包含可交互子元素的容器上删除 role=text,或把这些子元素移到容器之外。

role=text 应该包含什么?

这项技能说明,它应该只包含静态的文字内容。

详情

作者的原始描述

Use when reviewing rendered HTML, interactive components, or design-system patterns related to Avoid focusable descendants in role='text' elements. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2738
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能