diff --git a/.changeset/gentle-wolves-judge.md b/.changeset/gentle-wolves-judge.md new file mode 100644 index 0000000000..c5b2506e5c --- /dev/null +++ b/.changeset/gentle-wolves-judge.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': minor +--- + +Sidebar now persists its scroll position and expanded / contracted section state across page navigations. It also scrolls the active sidebar item into view if necessary. diff --git a/packages/starlight/components/Sidebar.astro b/packages/starlight/components/Sidebar.astro index c591674f3d..6a21059ba8 100644 --- a/packages/starlight/components/Sidebar.astro +++ b/packages/starlight/components/Sidebar.astro @@ -11,3 +11,90 @@ const { sidebar } = Astro.props;
+ +{ + /* Persist sidebar state across page navigations, + and scroll the active item into view if necessary. + This is intentionally inlined to avoid FOUSC + (Flash Of Un-Scrolled Content). */ +} +