From a550bcc328fb6e103677d098f188871541c6d82a Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: Mon, 17 Nov 2025 17:18:15 +0100 Subject: [PATCH 1/2] Optimise page outline Removing `AsideSectionHighlight` in favour of CSS-only changes on the active link element itself prevents a repaint and reduces lag (especially on Safari). --- .../src/components/PageAside/PageAside.tsx | 6 +++- .../PageAside/ScrollSectionsList.tsx | 32 +++++++------------ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/packages/gitbook/src/components/PageAside/PageAside.tsx b/packages/gitbook/src/components/PageAside/PageAside.tsx index 5bf96aeaf4..8874c6ba0a 100644 --- a/packages/gitbook/src/components/PageAside/PageAside.tsx +++ b/packages/gitbook/src/components/PageAside/PageAside.tsx @@ -169,7 +169,11 @@ async function PageAsideSections(props: { document: JSONDocument; context: GitBo const sections = await getDocumentSections(context, document); - return sections.length > 1 ? : null; + return sections.length > 1 ? ( +
+ +
+ ) : null; } function PageAsideActions(props: { diff --git a/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx b/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx index 37c24ba6f2..0fb2bb263e 100644 --- a/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx +++ b/packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx @@ -7,7 +7,6 @@ import { tcls } from '@/lib/tailwind'; import { useBodyLoaded } from '@/components/primitives'; import { HEADER_HEIGHT_DESKTOP } from '../layout'; -import { AsideSectionHighlight } from './AsideSectionHighlight'; /** * The threshold at which we consider a section as intersecting the viewport. @@ -44,7 +43,7 @@ export function ScrollSectionsList({ sections }: { sections: DocumentSection[] } return (