[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#3238
X-original-commit: f068065d39
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
parent
899479c18d
commit
b1efc8aad2
@ -16,8 +16,7 @@
|
|||||||
// Allow to automatically collapse and expand TOC entries
|
// Allow to automatically collapse and expand TOC entries
|
||||||
_prepareAccordion(pageToc);
|
_prepareAccordion(pageToc);
|
||||||
|
|
||||||
// Allow to respectively highlight and expand the TOC entries and their related TOC
|
// Highlight TOC entries whose section is focused and expand their TOC entry list.
|
||||||
// entry list whose section is focused.
|
|
||||||
_flagActiveTocEntriesAndLists(pageToc, headingRefs);
|
_flagActiveTocEntriesAndLists(pageToc, headingRefs);
|
||||||
|
|
||||||
// Allow to hide the TOC entry referring the title (<h1> heading)
|
// Allow to hide the TOC entry referring the title (<h1> heading)
|
||||||
@ -98,6 +97,12 @@
|
|||||||
// Highlight all <li> in the active hierarchy
|
// Highlight all <li> in the active hierarchy
|
||||||
tocEntry.classList.add('o_active_toc_entry');
|
tocEntry.classList.add('o_active_toc_entry');
|
||||||
|
|
||||||
|
// Update the attributes on the <i>.
|
||||||
|
const tocEntryWrapper = tocEntry.querySelector('.o_toc_entry_wrapper');
|
||||||
|
if (tocEntryWrapper) {
|
||||||
|
tocEntryWrapper.querySelector('i').setAttribute('aria-expanded', true);
|
||||||
|
}
|
||||||
|
|
||||||
// Expand all related <ul>
|
// Expand all related <ul>
|
||||||
const relatedTocEntryList = tocEntry.querySelector('ul');
|
const relatedTocEntryList = tocEntry.querySelector('ul');
|
||||||
if (relatedTocEntryList) {
|
if (relatedTocEntryList) {
|
||||||
|
Loading…
Reference in New Issue
Block a user