diff --git a/docs/content/fsdocs-theme.js b/docs/content/fsdocs-theme.js index 9ea6b3f7..220a6472 100644 --- a/docs/content/fsdocs-theme.js +++ b/docs/content/fsdocs-theme.js @@ -12,11 +12,18 @@ if (activeItem && mainMenu) { scrollToActiveItem(activeItem); } -if(location.hash) { - const header = document.querySelector(`a[href='${location.hash}']`); - header.scrollIntoView({ behavior: 'instant'}); +function scrollToAndExpandSelectedMember() { + if (location.hash) { + const header = document.querySelector(`a[href='${location.hash}']`); + header.scrollIntoView({ behavior: 'instant'}); + const details = document.querySelector(`tr > td.fsdocs-member-usage:has(a[href='${location.hash}']) ~ td.fsdocs-member-xmldoc > details`); + details?.setAttribute('open', 'true'); + } } +scrollToAndExpandSelectedMember(); +addEventListener('hashchange', _event => scrollToAndExpandSelectedMember()); + if(location.pathname.startsWith('/reference/')) { // Scroll to API Reference header const navHeaders = document.querySelectorAll(".nav-header");