Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 11
    +1 for talking about the semantic relationship and what it means beyond the functional clicking relationship. Commented Aug 13, 2015 at 19:00
  • 1
    Hi, I have two elements with the same id but in different div, I added focus event using label for but in second element it is focusing on first element. <html> <body> <div id="first_div"> <label for="name">Name</label> <input type="text" id="name"> </div> <div id="second_div"> <label for="name">Name</label> <input type="text" id="name"> </div> </body> </html> Commented Aug 1, 2019 at 6:19
  • The HTML specification dictates that ids need to be unique. Having duplicate ids is not supported and will have unintended consequences like what you're experiencing. Commented Apr 16, 2021 at 5:46
  • "the implicit association […] is not as widely supported as the explicit association via for and id attributes" -- The technique H44 in WCAG 2.0 you linked mentioned specific compatibility issues with JAWS 7.10 and Window-Eyes 5.5 on Windows XP with either IE 6 and Firefox 1.5. Now, almost 20 years after the release of Firefox 1.5, technique H44 in WCAG 2.1/2.2 no longer mentions such compatibility issues, yet it still suggests using an explicit for and it doesn't discuss implicit association, either. Does anyone know what the current state here is? Is implicit association still discouraged? Commented Jun 25, 2024 at 15:24
  • (continued) For instance, MDN's "Understanding the WCAG" says "The form element can be placed inside the <label>, in which case the association between the form element and the label is obvious from the structure." Commented Jun 25, 2024 at 15:29