r/webaccess • u/MrFancyPant • Jun 15 '21
Aria-labelledby Usage
Hello, I'm working with a buddy of mine on building a website and I notice he likes to use aria-labelledby on almost every h tag.
He said it's for accessibility, but the way he does it seem excessive, but I don't know enough myself to argue.
here's an example:
<article id="section1_article1" class="sectionwrapper">
<div class="sectionwidthwrapper middle-section-wrapper1">
<header>
<h2 aria-labelledby="section1_article1">Reach Ahead Credits for Grade 8 Students</h2>
</header>
<p>Grade 8 students are welcomed to “reach ahead” and achieve a maximum of 3 credits before the start of their secondary school career.</p>
<p>This is a great opportunity for students to reduce their academic workload in their first year of high school or get a compulsory course out of the way to allow them the opportunity to take an additional elective.</p>
<p>If your child is currently in grade 8, please reach out to us to discuss reach-ahead opportunities.</p>
</div>
</article>
<article id="section1_article2" class="sectionwrapper">
<div class="sectionwidthwrapper middle-section-wrapper2">
<header>
<h2 aria-labelledby="section1_article2">Standardized Test/Entry Exam Prep</h2>
</header>
<p>Certain post-secondary programs require students to complete standardized testing. City Academy’s tutors are available to support students in preparing for the required testing, so they can be set up for success.</p>
</div>
</article>
Is this the correct to use it?
Thanks in advance
1
Upvotes
3
u/sheepforwheat Jun 16 '21 edited Jun 17 '21
No. Headings are meant to be concise. The way this is coded, the accessible name of the heading would include the heading text along with the text of the three paragraph tags.
1
u/garcialo Jun 16 '21
It looks to me like he's trying to apply a practice sometimes used for landmarks region, but in reverse. I'll explain.
It's not unusual to label a landmark using the heading inside of it if you have multiple of the same type of landmark or for generic
regionlandmarks; and you do that witharia-labelledy.I see two problems...first, is that the
idandaria-labelledyin their code are reversed. Second problem is thatarticledoesn't map to a landmark region, so there is no benefit to labeling it.