-
Notifications
You must be signed in to change notification settings - Fork 868
Open
Labels
best practicefixBug fixesBug fixesrulesIssue or false result from an axe-core ruleIssue or false result from an axe-core rule
Description
Product
axe-core
Product Version
4.11.1
Latest Version
- I have tested the issue with the latest version of the product
Issue Description
Expectation
When the input has an aria-labelledby pointing to a node with sr-only Tailwind class, it should pass
Actual
When the input has an aria-labelledby pointing to a node with sr-only Tailwind class, it fails with label-title-only violation:
"Form elements should have a visible label (label-title-only)"
│ Fix all of the following:
│ Only title used to generate label for form element
How to Reproduce
<input type="file" name="profileImage" aria-labelledby="label" aria-describedby="hint" />
<div id="label" class="sr-only">Upload a file</div>
<span id="hint">Max 5 MB, .jpg or .png only</span>Fails
<input type="file" name="profileImage" aria-labelledby="label" aria-describedby="hint" />
<div id="label">Upload a file</div>
<span id="hint">Max 5 MB, .jpg or .png only</span>Passes
Additional Context
sr-only is used in Tailwind to only expose elements to screen readers, but axe doesn't seem to consider this when validating label-title-only
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
best practicefixBug fixesBug fixesrulesIssue or false result from an axe-core ruleIssue or false result from an axe-core rule