Domanda

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"?

È stato utile?

Soluzione

"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).

Altri suggerimenti

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!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top