summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorζŽη‘žδΈ°2023-05-17 16:33:36 +0800
committerGitHub2023-05-17 10:33:36 +0200
commit608f34cbbe485c39730f33828971397f9c8a3534 (patch)
tree24f65e2f4a77203200d85cd794bc8312534ba1c0
parent5b6cccb7f9ee5810c75fbbb45496e2a1d022f7dd (diff)
downloadIT.starlight-608f34cbbe485c39730f33828971397f9c8a3534.tar.gz
IT.starlight-608f34cbbe485c39730f33828971397f9c8a3534.tar.bz2
IT.starlight-608f34cbbe485c39730f33828971397f9c8a3534.zip
Fix ToC headingsObserver rootMargin (#61)
-rw-r--r--.changeset/fifty-adults-accept.md5
-rw-r--r--packages/starlight/components/TableOfContents/starlight-toc.ts2
2 files changed, 6 insertions, 1 deletions
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.