From 70d8dacc10eacbc7b93ebfa91c7893cac058d7cc Mon Sep 17 00:00:00 2001 From: Brian Rourke Boll Date: Fri, 24 May 2024 12:35:28 -0400 Subject: [PATCH] Expand details of selected member --- docs/content/fsdocs-theme.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/content/fsdocs-theme.js b/docs/content/fsdocs-theme.js index 9ea6b3f7d..220a6472d 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");