-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dev-toolbar): false positive in Audit with a11y check on labels (#…
…12223) * fix(dev-toolbar): false positive in Audit with a11y check on labels * test: add e2e test for a11y audit on labelable elements * docs: complete changeset to explain why this is a problem
- Loading branch information
1 parent
fb55695
commit 79ffa5d
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes a false positive reported by the dev toolbar Audit app where a label was considered missing when associated with a button | ||
|
||
The `button` element can be [used with a label](https://www.w3.org/TR/2011/WD-html5-author-20110809/forms.html#category-label) (e.g. to create a switch) and should not be reported as an accessibility issue when used as a child of a `label`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/astro/e2e/fixtures/dev-toolbar/src/pages/a11y-labelable.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
--- | ||
|
||
<label for="button1">Button label</label> | ||
<button id="button1" /> | ||
<label> | ||
Button label as child | ||
<button>Activate?</button> | ||
</label> | ||
<label for="input1">Input label</label> | ||
<input id="input1" /> | ||
<label> | ||
Input label as child | ||
<input type="text" /> | ||
</label> | ||
<label for="meter1">Meter label</label> | ||
<meter id="meter1" min="0" max="100" value="75">75%</meter> | ||
<label> | ||
Meter label as child | ||
<meter min="0" max="100" value="75">75%</meter> | ||
</label> | ||
<label for="output1">Output label</label> | ||
<output id="output1">"Hello, world!"</output> | ||
<label> | ||
Output label as child | ||
<output>"Hello, world!"</output> | ||
</label> | ||
<label for="progress1">Progress label</label> | ||
<progress id="progress1" max="100" value="70">70%</progress> | ||
<label> | ||
Progress label as child | ||
<progress max="100" value="70">70%</progress> | ||
</label> | ||
<label for="select1">Select label</label> | ||
<select id="select1"> | ||
<option>Option 1</option> | ||
<option>Option 2</option> | ||
<option>Option 3</option> | ||
</select> | ||
<label> | ||
Select label as child | ||
<select> | ||
<option>Option 1</option> | ||
<option>Option 2</option> | ||
<option>Option 3</option> | ||
</select> | ||
</label> | ||
<label for="textarea1">Textarea label</label> | ||
<textarea cols="33" id="textarea1" rows="5" /> | ||
<label> | ||
Textarea label as child | ||
<textarea cols="33" rows="5" /> | ||
</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters