diff --git a/src/index.css b/src/index.css index e4b084e6..70a017af 100644 --- a/src/index.css +++ b/src/index.css @@ -273,11 +273,6 @@ code { } } -details:not([open]) > summary ~ * { - /* HACK: allow JS know that this is invisible */ - --invisible: 1; -} - [tabindex='-1'] { outline: 0; } diff --git a/src/pages/status.jsx b/src/pages/status.jsx index ac5994ce..0d972dcb 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -351,10 +351,13 @@ function StatusPage() { ); const activeStatusRect = activeStatus?.getBoundingClientRect(); const allStatusLinks = Array.from( - scrollableRef.current.querySelectorAll('.status-link, .status-focus'), - ).filter((s) => { - return !getComputedStyle(s).getPropertyValue('--invisible'); - }); + // Select all statuses except those inside collapsed details/summary + // Hat-tip to @AmeliaBR@front-end.social + // https://front-end.social/@AmeliaBR/109784776146144471 + scrollableRef.current.querySelectorAll( + '.status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)', + ), + ); console.log({ allStatusLinks }); if ( activeStatus && @@ -386,10 +389,10 @@ function StatusPage() { ); const activeStatusRect = activeStatus?.getBoundingClientRect(); const allStatusLinks = Array.from( - scrollableRef.current.querySelectorAll('.status-link, .status-focus'), - ).filter((s) => { - return !getComputedStyle(s).getPropertyValue('--invisible'); - }); + scrollableRef.current.querySelectorAll( + '.status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)', + ), + ); if ( activeStatus && activeStatusRect.top < scrollableRef.current.clientHeight &&