From d935fb1b2e01ad9c4b012f9d02a71f7d1219682b Mon Sep 17 00:00:00 2001 From: Scott Cazan Date: Wed, 5 Feb 2025 12:26:31 +0100 Subject: [PATCH] Only push scrolling down when Footer is present (#2807) --- .changeset/cold-cameras-work.md | 5 +++++ .../(site)/(content)/[[...pathname]]/not-found.tsx | 10 +++++++++- .../src/components/SpaceLayout/SpaceLayout.tsx | 13 ++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 .changeset/cold-cameras-work.md diff --git a/.changeset/cold-cameras-work.md b/.changeset/cold-cameras-work.md new file mode 100644 index 000000000..5eed9ac12 --- /dev/null +++ b/.changeset/cold-cameras-work.md @@ -0,0 +1,5 @@ +--- +'gitbook': patch +--- + +Don't add extra page scroll when footer is not present diff --git a/packages/gitbook/src/app/middleware/(site)/(content)/[[...pathname]]/not-found.tsx b/packages/gitbook/src/app/middleware/(site)/(content)/[[...pathname]]/not-found.tsx index cd36e5b26..d218b9aa2 100644 --- a/packages/gitbook/src/app/middleware/(site)/(content)/[[...pathname]]/not-found.tsx +++ b/packages/gitbook/src/app/middleware/(site)/(content)/[[...pathname]]/not-found.tsx @@ -15,7 +15,15 @@ export default async function NotFound() { return (

diff --git a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx index a214c22d8..4dc5be4fb 100644 --- a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx +++ b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx @@ -78,6 +78,12 @@ export async function SpaceLayout(props: { const visitorAuthToken = await getCurrentVisitorToken(); const enabled = await shouldTrackEvents(); + const withFooter = + customization.themes.toggeable || + customization.footer.copyright || + customization.footer.logo || + customization.footer.groups?.length; + return ( @@ -174,10 +180,7 @@ export async function SpaceLayout(props: {

- {customization.themes.toggeable || - customization.footer.copyright || - customization.footer.logo || - customization.footer.groups?.length ? ( + {withFooter ? (