Skip to content

Conversation

@zenoachtig
Copy link
Contributor

@zenoachtig zenoachtig commented Dec 2, 2025

This pull request introduces a new SideSheet component and refactors the TOC and AIChat to use it.

SideSheet component

  • Adds SideSheet component, responsible for rendering a component in a fixed sidebar (with optional backdrop) on the left or right of the screen. It can be controlled with an open prop (needed for AIChat) or watch for changes on the body (needed for TableOfContents).
  • Refactored TableOfContents and AIChat to use SideSheet

ScrollContainer component

  • Refactored TableOfContents to use ScrollContainer, removed the custom TOCScrollContainer in favour of the standard component we use elsewhere. This gives us goodies like faded edges and scroll buttons, in addition to standardising the component.
  • Updated active prop on ScrollContainer to take any query selector instead of an ID.

Other layout updates

  • Moved layout of TOC's innerHeader to live in one place, namely SpaceLayout, instead of splitting across two files
  • Simplified HeaderMobileMenu to no longer have
  • Updated layout components (CustomizationRootLayout, SiteDynamicLayout, SiteStaticLayout) to accept both a htmlClassName and bodyClassName, needed to set some sheet-related classes that only work on html or body.
  • Improved support for devices with notches by adding safe-area-insets and viewportFit: cover to the viewport meta tag.
  • Simplified HeaderMobileMenu button by removing scroll tracking and state management now it's always occluded by a sidesheet.
  • Fixed minor UI issues in AnnouncementBanner when using safe-area-insets

@linear
Copy link

linear bot commented Dec 2, 2025

@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

🦋 Changeset detected

Latest commit: 1586444

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@argos-ci
Copy link

argos-ci bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) 👍 Changes approved 78 changed Jan 7, 2026, 10:24 AM
v2-cloudflare (Inspect) 👍 Changes approved 399 changed Jan 7, 2026, 10:29 AM
v2-vercel (Inspect) 👍 Changes approved 413 changed Jan 7, 2026, 10:29 AM

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a new reusable SideSheet component to standardize the behavior of slide-in panels and refactors the Table of Contents (TOC) and AI Chat to use it. The PR also improves the ScrollContainer component API and adds comprehensive support for devices with notches using safe-area-insets.

Key Changes

  • Adds a new SideSheet component with both controlled and uncontrolled modes, supporting modal behavior with scrim and close button
  • Refactors ScrollContainer to accept query selectors instead of just IDs for active elements, and restructures the API with leading/trailing configuration objects
  • Consolidates layout logic for TOC's inner header into SpaceLayout and improves mobile/desktop responsiveness

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
packages/gitbook/src/components/primitives/SideSheet.tsx New component providing reusable slide-in panel functionality with modal support, animations, and dual control modes
packages/gitbook/src/components/primitives/ScrollContainer.tsx Enhanced to support query selectors for active items and restructured leading/trailing edge configuration
packages/gitbook/src/components/TableOfContents/TableOfContents.tsx Refactored to use SideSheet component instead of custom positioning, integrated with ScrollContainer
packages/gitbook/src/components/TableOfContents/TOCScroller.tsx Removed custom scroll context in favor of standard ScrollContainer
packages/gitbook/src/components/TableOfContents/Trademark.tsx Simplified from Link-based to Button-based component, removed complex wrapper styling
packages/gitbook/src/components/AIChat/AIChat.tsx Refactored to use SideSheet for consistent modal behavior and positioning
packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx Consolidated TOC header and inner header layout logic into a single location
packages/gitbook/src/components/layout.ts Added safe-area-inset support with max() functions for notched devices
packages/gitbook/src/components/RootLayout/CustomizationRootLayout.tsx Added separate htmlClassName and bodyClassName props for better class management
packages/gitbook/tailwind.config.ts Updated animations to use 'display: inherit' instead of 'block', added sheet-open variant, adjusted timing from 250ms to 300ms
packages/icons/src/IconsProvider.tsx Added defensive check to ensure icon parameter is always a string
packages/gitbook/src/components/primitives/HoverCard.tsx Increased z-index from 40 to 50 to appear above side sheet scrim
packages/gitbook/src/components/Header/HeaderMobileMenu.tsx Simplified by removing scroll tracking and active state management
packages/gitbook/src/components/Announcement/AnnouncementBanner.tsx Wrapped content in additional div to fix positioning with safe-area-insets
packages/gitbook/src/components/SiteLayout/SiteLayout.tsx Added viewportFit: 'cover' to viewport metadata for notch support
packages/gitbook/src/components/Header/Header.tsx Added top padding using safe-area-inset-top
packages/gitbook/src/components/Cookies/CookiesToast.tsx Updated positioning to use safe-area-insets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants