Does `aria-labelledby` work if the id is on a parent element?
I have a unique use case where I have a
{{ heading }}
twig expression that renders markdown. So {{ heading }}
will evaluate to something like <h2>Lorem ipsum</h2>
.
Therefore, I need to put the id on a parent element (see attached). Will this still be accessible? I'm trying to provide a name to my section
4 Replies
Reading mdn docs too, I could use
aria-label
which would be the same thing but easierIt is preferred to use an existing heading/labelledby if it exists on the page rather than the redundancy of an aria-label when there’s already a heading that you can create the relationship with. And , yes you can reference the id of a parent element for the attr value
Ty!!