question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confusion with require-input-label

See original GitHub issue

I have the following template code that triggered the require-input-label lint:

<div class="search-input">
  <label class="visually-hidden" for="search-input">Search</label>
  <input
    id="search-input"
    type="search"
    placeholder="Search deprecations"
    autocomplete="off"
    aria-label="Search"
    {{on "input" (perform this.searchService.search value="target.value")}}
  >
</div>

I was a bit confused as I have label and an aria-label, and wasn’t sure how to address it. I ended up removing aria-label at the suggestion of someone in Discord.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MelSumnercommented, Jun 8, 2021

@runspired yeah that would be a bug in that case; it’s perfectly valid to have a nested label/input and an id.

0reactions
MelSumnercommented, Sep 28, 2021

Issue should be resolved with #1994 but please re-open if you still see any issues. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Success Criterion 3.3.2 - W3C
When label elements are associated with input elements the label is spoken by screen readers when the field receives focus and users with...
Read more >
Indicating form controls as required using asterisks (*) - ADG
Asterisk (*) next to a form control's label usually indicates it as "required". ... In the following example, the required input field is...
Read more >
HTML Inputs and Labels: A Love Story | CSS-Tricks
In this post, I want to focus on situations where the lack of a semantic label and input combination makes it much harder...
Read more >
The Anatomy of Accessible Forms: Required Form Fields
How to indicate a required field · Provide the required text in the label. · Provide a graphic * image in the label...
Read more >
<form> Confusion - HTML - Codecademy Forums
<input id="animal-1" name="animal-1" type="text" required>``` ... The for attribute is usually used to associate a element such as <label> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found