From 5414d2dd29740fc2645d22fef9f0297fa7d99077 Mon Sep 17 00:00:00 2001
From: Olivia Simonet <91660674+Olivia206@users.noreply.github.com>
Date: Fri, 6 Sep 2024 15:31:25 +0200
Subject: [PATCH] =?UTF-8?q?[A11Y]=20Table=20des=20mati=C3=A8res=20(#586)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 assets/js/theme/design-system/toc.js | 4 +++-
 layouts/partials/toc/container.html  | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/assets/js/theme/design-system/toc.js b/assets/js/theme/design-system/toc.js
index e6db3710..be65283b 100644
--- a/assets/js/theme/design-system/toc.js
+++ b/assets/js/theme/design-system/toc.js
@@ -116,11 +116,13 @@ class TableOfContents {
         this.links.forEach((link) => {
             if (link === currentLink) {
                 link.classList.add(CLASSES.linkActive);
+                link.setAttribute('aria-current', 'true');
                 this.updateCtaTitle(link);
                 this.state.id = id;
                 this.state.currentLink = link;
             } else {
-                link.classList.remove(CLASSES.linkActive)
+                link.classList.remove(CLASSES.linkActive);
+                link.removeAttribute('aria-current');
             }
         });
     }
diff --git a/layouts/partials/toc/container.html b/layouts/partials/toc/container.html
index 255253d1..8cb67b92 100644
--- a/layouts/partials/toc/container.html
+++ b/layouts/partials/toc/container.html
@@ -6,7 +6,7 @@
   <div class="toc-container" aria-hidden="false" aria-labelledby="toc-title">
     <div class="toc-content">
       {{/* TODO : quelle balise pour le titre du toc ? */}}
-      <div id="toc-title" class="toc-title">{{ i18n "commons.toc" }}</div>
+      <div id="toc-title" class="toc-title" role="heading">{{ i18n "commons.toc" }}</div>
       {{- partial (printf .toc) . -}}
       <button name="{{ i18n "commons.close" }}">{{ i18n "commons.close" }}</button>
     </div>
-- 
GitLab