Merge pull request #19283 from open-craft/frank/expand-subsection-when-anchored
[BB-527] expand subsections when the url anchor points to them.
This commit is contained in:
@@ -96,5 +96,17 @@ export class CourseOutline { // eslint-disable-line import/prefer-default-expor
|
||||
});
|
||||
event.stopImmediatePropagation();
|
||||
});
|
||||
|
||||
const urlHash = window.location.hash;
|
||||
|
||||
if (urlHash !== '') {
|
||||
const button = document.getElementById(urlHash.substr(1, urlHash.length));
|
||||
if (button.classList.contains('subsection-text')) {
|
||||
const parentLi = button.closest('.section');
|
||||
const parentButton = parentLi.querySelector('.section-name');
|
||||
expandSection(parentButton);
|
||||
}
|
||||
expandSection(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user