ElodieA
|
I’m confused about when I should be using the aria-labelledby attribute. Should it be used on every chapter <section> for a novel? The book I’ve made is organized so that one chapter = one xhtml file. Because only one doc-chapter attribute appears per file, would it be overkill to use an “aria-labelledby” attribute as seen in the code below?
For example:
<body>
<section epub:type=”bodymatter chapter” role=”doc-chapter” aria-labelledby=”hd1″>
<span id=”page1″ epub:type=”pagebreak” role=”doc-pagebreak” aria-label=”Page 1″></span>
<h1 id=”hd1″ class=”chapternumber”>1 <br/>
<span class=”chaptername”>Name</span></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
…
</section>
</body>
</html>
Is that the correct markup? Or should the aria-labelledby attribute be removed?
Thank you!
January 17, 2023 at 1:53 pm
|
APLN Moderator
|
Hi ElodieA,
Thanks for your question!
The aria-labelledby attribute points to a label—usually a heading—in a section that is considered an important part of the EPUB, which users can quickly navigate to. It is actually helpful to have a unique aria-labelledby for each chapter since each content chapter has the same role (doc-chapter).
It is up to your discretion to identify key components of the EPUB and apply aria-labelledby to those sections. Key components may include text chapters, prologue, part, glossary, appendix, etc. Aria-labelledby can also be used for titled asides or other important secondary sections (that are marked by headings) that may appear multiple times in a publication.
TL;DR, yes, the use of aria-labelledby in your example is correct. However, I would change the epub:type in your example to epub:type=”chapter”, as “bodymatter” is a separate semantic value and does not have an associated ARIA role.
February 2, 2023 at 12:43 pm
|
ElodieA
|
Thanks so much for responding! I really appreciate it 🙂
February 5, 2023 at 8:16 pm
|