Question

on an form, can the aria-labelledby attribute work on its own or does it require a label tag?

EXAMPLE: Does it work like this

aria-labelledby="Name"

Read by the browser as "Name"?

Was it helpful?

Solution

"The aria-labelledby attribute is used to indicate the IDs of the elements that are the labels for the object." (MDN).

It does not contain a text label.

So no, it doesn't work on its own.

It doesn't require a <label> element, but if a <label> is the correct HTML element for the context then you should use one. (Start with correct, semantic HTML, then build ARIA on top of it).

OTHER TIPS

It requires a Label tag and is meant to work in conjunction with an associated input tag. Check out this link for more information: http://www.w3.org/TR/2013/WD-aria-in-html-20130214/#aria-labelledby-and-aria-describedby

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top