Rule request: add condition to `require-input-label` rule
See original GitHub issueContext
Currently, the require-input-label
rule does not check for instances where a valid label has already been provided but another label is associated with the input element through the use of the aria-labelledby
attribute.
We could update the require-input-label
rule or create a separate rule called no-duplicate-label
.
Task
Update the rule so it checks for redundant labels- if the <input>
element already has an associated <label>
element, it does not require the aria-label
or aria-labelledby
attributes.
Examples
Not okay
<label for="input-search">Search</label>
<input type="text" aria-labelledby="button-search" id="input-search" />
<button id="button-search" type="button">Search</button>
Okay
<input type="text" aria-labelledby="button-search" />
<button id="button-search" type="button">Search</button>
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
require-input-label - ember-template-lint - GitHub
This rule checks to see if the input is contained by a label element. If it is not, it checks to see if...
Read more >Validating Input | Web Accessibility Initiative (WAI) - W3C
Validating required input. Forms frequently include required input that needs to be clearly identified using labels. Also, the required attribute can be added...
Read more >The Label element - HTML: HyperText Markup Language | MDN
The label text is not only visually associated with its corresponding text input; it is programmatically associated with it too.
Read more >q-input has value then only Rules will apply - vue.js
!= '' then only i want to apply the Rules like required 8 number maximum. In the below code it gives me the...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
Available Validation Rules; Conditionally Adding Rules; Validating Arrays. Validating Nested Array Input; Error Message Indexes & Positions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MelSumner I’ve opened a draft PR.
I can have a look at this one