+
+
-
- {siteSpaces.length > 1 && (
-
-
-
+ {siteSpaces.length > 1 && (
+
+
+
+ )}
+ {sections &&
+ (sections.list.some((s) => s.object === 'site-section-group') || // If there's even a single group, show the tabs
+ sections.list.length > 1) && ( // Otherwise, show the tabs if there's more than one section
+
)}
- {sections &&
- (sections.list.some((s) => s.object === 'site-section-group') || // If there's even a single group, show the tabs
- sections.list.length > 1) && ( // Otherwise, show the tabs if there's more than one section
-
- )}
-
diff --git a/packages/gitbook/src/components/RootLayout/globals.css b/packages/gitbook/src/components/RootLayout/globals.css
index d32cee38a3..8d22180b0c 100644
--- a/packages/gitbook/src/components/RootLayout/globals.css
+++ b/packages/gitbook/src/components/RootLayout/globals.css
@@ -20,8 +20,7 @@
}
}
-@utility hide-scroll {
- /* hide scroll bar but still scroll */
+@utility no-scrollbar {
&::-webkit-scrollbar {
display: none;
}
@@ -29,6 +28,22 @@
-ms-overflow-style: none;
}
+@utility hide-scrollbar {
+ /* Hide scrollbar by default */
+ scrollbar-color: transparent transparent;
+ transition: scrollbar-color 0.2s ease-in-out;
+
+ &:hover {
+ /* Show scrollbar on hover */
+ scrollbar-color: unset;
+ }
+
+ @media (prefers-contrast: more) {
+ /* Always show scrollbar in high contrast mode */
+ scrollbar-color: unset;
+ }
+}
+
@utility linear-mask-gradient {
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 96px, rgba(0, 0, 0, 0));
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 96px, rgba(0, 0, 0, 0));
@@ -143,47 +158,6 @@
@apply bg-linear-to-bl from-tint-4 to-tint-base to-60% bg-fixed;
}
-@utility scroll-nojump {
- /**
- * Utility to prevent horizontal jumps when the vertical scrollbar appears
- * It should be used on main containers of the layout, while preserving horizontal delimiters.
- * It basically adds a margin-left with the width of the scrollbar, and a width that compensates for it; when a scrollbar is displayed.
- * Inspired by https://aykevl.nl/2014/09/fix-jumping-scrollbar, but adapted to work on child elements of "html"
- */
- width: 100%;
- @media screen and (min-width: 1536px) {
- margin-left: var(--scrollbar-width);
- margin-right: 0;
- width: calc(100% - var(--scrollbar-width));
- body:has(.page-full-width) & {
- margin-left: 0;
- width: 100%;
- }
- }
-
- /**
- * Utility to prevent horizontal jumps when the vertical scrollbar appears
- * It should be used on main containers of the layout, while preserving horizontal delimiters.
- * It basically adds a margin-left with the width of the scrollbar, and a width that compensates for it; when a scrollbar is displayed.
- * Inspired by https://aykevl.nl/2014/09/fix-jumping-scrollbar, but adapted to work on child elements of "html"
- */
- width: 100%;
- @media screen and (min-width: 1536px) {
- margin-left: var(--scrollbar-width);
- margin-right: 0;
- width: calc(100% - var(--scrollbar-width));
- }
-}
-
-@utility page-full-width {
- @media screen and (min-width: 1536px) {
- body:has(&) .scroll-nojump {
- margin-left: 0;
- width: 100%;
- }
- }
-}
-
@utility elevate-link {
& a[href]:not(.link-overlay) {
position: relative;
@@ -211,15 +185,59 @@
@layer base {
:root {
- --scrollbar-width: calc(100vw - 100%);
@apply leading-relaxed;
interpolate-size: allow-keywords; /* Opt-in for modern browsers to interpolate "auto" values in transitions/animations. */
}
+
+ /* Modern browsers with `scrollbar-*` support */
+ @supports (scrollbar-color: auto) {
+ * {
+ scrollbar-color: theme("colors.tint.7") transparent;
+ scrollbar-width: thin;
+ }
+
+ @media (prefers-contrast: more) {
+ * {
+ scrollbar-color: theme("colors.tint.11") transparent;
+ scrollbar-width: auto;
+ }
+ }
+ }
+
+ /* Otherwise, use `::-webkit-scrollbar-*` pseudo-elements */
+ @supports selector(::-webkit-scrollbar) {
+ ::-webkit-scrollbar {
+ background: transparent;
+ max-width: 8px;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ background: theme("colors.tint.7");
+ border-radius: 8px;
+ transition: background 0.2s ease-in-out;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background: theme("colors.tint.8");
+ }
+
+ @media (prefers-contrast: more) {
+ ::-webkit-scrollbar-thumb {
+ background: theme("colors.tint.11");
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background: theme("colors.tint.12");
+ }
+ }
+ }
+
+
body {
@apply text-tint-strong antialiased;
}
html {
- @apply gutter-stable;
+ scrollbar-width: auto;
}
h1 {
@apply tracking-[-0.025em] text-tint-strong text-balance;
@@ -250,22 +268,6 @@
@apply subpixel-antialiased;
}
- /* Light mode */
- ::-webkit-scrollbar {
- @apply bg-tint-subtle;
- width: 8px;
- height: 8px;
- }
-
- ::-webkit-scrollbar-thumb {
- @apply bg-tint-7;
- border-radius: 8px;
- }
-
- ::-webkit-scrollbar-thumb:hover {
- @apply bg-tint-8;
- }
-
.flip-heading-hash {
@apply [h1,h2,h3,h4]:content-start;
@apply [h1,h2,h3,h4]:auto-cols-[auto_1fr];
diff --git a/packages/gitbook/src/components/Search/SearchContainer.tsx b/packages/gitbook/src/components/Search/SearchContainer.tsx
index bbd358d3e4..dc70365445 100644
--- a/packages/gitbook/src/components/Search/SearchContainer.tsx
+++ b/packages/gitbook/src/components/Search/SearchContainer.tsx
@@ -194,7 +194,7 @@ export function SearchContainer(props: SearchContainerProps) {
onOpenAutoFocus: (event) => event.preventDefault(),
align: 'start',
className:
- 'bg-tint-base has-[.empty]:hidden scroll-py-2 w-128 p-2 max-h-[min(32rem,var(--radix-popover-content-available-height))] max-w-[min(var(--radix-popover-content-available-width),32rem)]',
+ 'bg-tint-base has-[.empty]:hidden gutter-stable scroll-py-2 w-128 p-2 pr-1 max-h-[min(32rem,var(--radix-popover-content-available-height))] max-w-[min(var(--radix-popover-content-available-width),32rem)]',
onInteractOutside: (event) => {
// Don't close if clicking on the search input itself
if (searchInputRef.current?.contains(event.target as Node)) {
diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
index 26cb341d7f..7feb98795d 100644
--- a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
+++ b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
@@ -38,7 +38,7 @@ export function SiteSectionList(props: { sections: ClientSiteSections; className
>
{sectionsAndGroups.map((item) => {
if (item.object === 'site-section-group') {
diff --git a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx
index 216bd5a001..1b2ca97094 100644
--- a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx
+++ b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx
@@ -81,82 +81,81 @@ export function SpaceLayout(props: {
{customization.ai?.mode === CustomizationAIMode.Assistant ? (
) : null}
-
-
-
-
+
+ )
+ }
+ innerHeader={
+ // displays the search button and/or the space dropdown in the ToC according to the header/variant settings. E.g if there is no header, the search button will be displayed in the ToC.
+ <>
+ {!withTopHeader && (
+ 1}
+ spaceTitle={siteSpace.title}
+ siteSpaceId={siteSpace.id}
+ className="max-lg:hidden"
+ viewport="desktop"
+ />
+ )}
+ {!withTopHeader && withSections && sections && (
+
+ )}
+ {isMultiVariants && !sections && (
+
-
-
- )
- }
- innerHeader={
- // displays the search button and/or the space dropdown in the ToC according to the header/variant settings. E.g if there is no header, the search button will be displayed in the ToC.
- <>
- {!withTopHeader && (
-
1}
- spaceTitle={siteSpace.title}
- siteSpaceId={siteSpace.id}
- className="max-lg:hidden"
- viewport="desktop"
- />
- )}
- {!withTopHeader && withSections && sections && (
-
- )}
- {isMultiVariants && !sections && (
-
- )}
- >
- }
- />
- {children}
-
+ />
+ )}
+ >
+ }
+ />
+
{children}
diff --git a/packages/gitbook/src/components/TableOfContents/TableOfContents.tsx b/packages/gitbook/src/components/TableOfContents/TableOfContents.tsx
index 9afcc33d10..5cca5257fa 100644
--- a/packages/gitbook/src/components/TableOfContents/TableOfContents.tsx
+++ b/packages/gitbook/src/components/TableOfContents/TableOfContents.tsx
@@ -101,12 +101,7 @@ export async function TableOfContents(props: {
className={tcls(
'flex grow flex-col p-2',
customization.trademark.enabled && 'lg:pb-20',
- 'lg:gutter-stable overflow-y-auto',
- '[&::-webkit-scrollbar]:bg-transparent',
- '[&::-webkit-scrollbar-thumb]:bg-transparent',
- '[&::-webkit-scrollbar]:group-hover:bg-tint-subtle',
- '[&::-webkit-scrollbar-thumb]:group-hover:bg-tint-7',
- '[&::-webkit-scrollbar-thumb:hover]:group-hover:bg-tint-8'
+ 'hide-scrollbar overflow-y-auto'
)}
>