aria-describedby can broadly be used to describe relationships. We have other tools in our pocket for giving a label to a field or other interactive object. We can also use aria-label, and that allows us to put text for the screen reader only into our code, or aria-labelledby. aria-labelledby takes an ID, so that is where something that’s visually on the page can be linked. Those things would replace the HTML label. The third option is this aria-describedby, that will link it to the field, but that does not replace the label, it announces it as secondary. That also takes an ID.
Two places I would say aria-describedby is used commonly would be if we had instructions for the field. Say we have a birthdate field, and under the field we have text that says MM/DD/YYYY. We would give that an ID, and give the text field aria-describedby equals that ID. We would also use the same code to associate an error with the field that it’s describing.
Comments
0 comments
Article is closed for comments.