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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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.
热度
- GitHub 星标
- 75k
- 排名
- #2738
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。