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:
David Joy
2020-03-04 16:53:12 -05:00
committed by GitHub

View File

@@ -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);
}
}
}