DEV Community

Discussion on: The what, why and how on labels

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Great and detailed article! ❤ and 🦄 from me!

One thing to note that may not be clear, although a <button> is labelable, the label should not be set with the <label> element (the text inside the button is the label).

Similarly if for some reason you are using <input type="button"> then the value attribute is treated as the label and a <label> element should not be used.

Using a <label> can actually make accessibility worse for <button> elements!

Given the subject of the post being focused on the <label> element I thought that was an important distinction.

Collapse
 
beingfrankly profile image
Frank van Eldijk-Smeding

Thanks @inhuofficial for the great reply! I'll change the post to include this as well, totally missed this while I was writing the post! :-)

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

I could tell from the accuracy it was more of an unintended implication than anything else. One of the most accurate and complete articles I have read on labels as they all forget voice etc.

I look forward to the next instalment!