使用SortSite检测网站无障碍性遇“Text Not Allowed”错误求助
Troubleshooting SortSite's "Text Not Allowed" Accessibility Error
Hey there, I’ve run into this exact "Text Not Allowed" error with SortSite before when auditing accessibility compliance—let me share some common causes and troubleshooting steps that helped me:
- Check text in decorative elements: SortSite flags text inside elements that should be purely visual (like
<svg>icons,<i>tags for glyphs) if they contain visible text without proper accessibility handling. For example:- SVG files with
<text>elements that aren’t marked witharia-hidden="true" - Icon containers (like
<span class="icon">Home</span>) where the text is visible but redundant to the icon’s purpose
- SVG files with
- Validate form control structure: This error often pops up if you’ve placed text directly inside form elements that shouldn’t contain child text nodes. Examples include:
<input type="submit">Submit</input>(use thevalueattribute instead, or wrap text in a<button>tag)<select>tags with text outside of<option>/<optgroup>children
- Audit hidden element text handling: Elements hidden with
display: noneorvisibility: hiddenbut missingaria-hidden="true"might trigger this error. SortSite may interpret the hidden text as unnecessary or non-compliant if it’s not properly marked for screen readers. - Fix HTML semantic mistakes: Look for text in non-content tags like
<meta>,<link>, or unclosed<script>/<style>tags that accidentally render text on the page. These semantic violations are a frequent culprit. - Narrow down the problematic code: If you’re scanning an entire site, test individual pages first. Then, disable sections or components one by one to pinpoint which part of the code is triggering the error. This makes debugging way easier.
- Verify SortSite rule configuration: Double-check that you’re using the correct accessibility standard (WCAG 2.1 AA, WCAG 2.2, etc.) in your SortSite settings. Sometimes outdated rule sets or misconfigured checks can cause false positives—try updating the tool to the latest version too.
If none of these steps resolve the issue, sharing a snippet of the HTML code where the error occurs would help the community give more targeted advice.
内容的提问来源于stack exchange,提问作者user1255154
相关产品推荐
相关产品推荐

