From f068065d397f2706583ee517aff0165b197269c4 Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Wed, 21 Dec 2022 14:42:06 +0000 Subject: [PATCH] [FIX] odoo_theme: update the aria attributes when scrolling the page TOC The 'aria-expanded' attribute was not correctly updated on the `i` tag when the user scrolled through the page TOC. This caused a minor issue where an arrow (`i`) that was collapsed manually with a click would no longer automatically expand afterward. task-3106339 closes odoo/documentation#3224 Signed-off-by: Antoine Vandevenne (anv) --- extensions/odoo_theme/static/js/page_toc.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/odoo_theme/static/js/page_toc.js b/extensions/odoo_theme/static/js/page_toc.js index 14678d703..7f972d6d4 100644 --- a/extensions/odoo_theme/static/js/page_toc.js +++ b/extensions/odoo_theme/static/js/page_toc.js @@ -16,8 +16,7 @@ // Allow to automatically collapse and expand TOC entries _prepareAccordion(pageToc); - // Allow to respectively highlight and expand the TOC entries and their related TOC - // entry list whose section is focused. + // Highlight TOC entries whose section is focused and expand their TOC entry list. _flagActiveTocEntriesAndLists(pageToc, headingRefs); // Allow to hide the TOC entry referring the title (

heading) @@ -98,6 +97,12 @@ // Highlight all
  • in the active hierarchy tocEntry.classList.add('o_active_toc_entry'); + // Update the attributes on the . + const tocEntryWrapper = tocEntry.querySelector('.o_toc_entry_wrapper'); + if (tocEntryWrapper) { + tocEntryWrapper.querySelector('i').setAttribute('aria-expanded', true); + } + // Expand all related
      const relatedTocEntryList = tocEntry.querySelector('ul'); if (relatedTocEntryList) {