From 608f34cbbe485c39730f33828971397f9c8a3534 Mon Sep 17 00:00:00 2001 From: 李瑞丰 Date: Wed, 17 May 2023 16:33:36 +0800 Subject: Fix ToC headingsObserver rootMargin (#61) --- .changeset/fifty-adults-accept.md | 5 +++++ packages/starlight/components/TableOfContents/starlight-toc.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fifty-adults-accept.md diff --git a/.changeset/fifty-adults-accept.md b/.changeset/fifty-adults-accept.md new file mode 100644 index 00000000..f5624d05 --- /dev/null +++ b/.changeset/fifty-adults-accept.md @@ -0,0 +1,5 @@ +--- +"@astrojs/starlight": patch +--- + +Fix toc headingsObserver rootMargin diff --git a/packages/starlight/components/TableOfContents/starlight-toc.ts b/packages/starlight/components/TableOfContents/starlight-toc.ts index 450fad08..fd194450 100644 --- a/packages/starlight/components/TableOfContents/starlight-toc.ts +++ b/packages/starlight/components/TableOfContents/starlight-toc.ts @@ -69,7 +69,7 @@ export class StarlightTOC extends HTMLElement { }; const headingsObserver = new IntersectionObserver(setCurrent, { - rootMargin: '5% 0% -85%', + rootMargin: '-10% 0% -85%', }); // Observe elements with an `id` (most likely headings) and their siblings. -- cgit