Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue where the space dropdown was shown under the site sections in Safari. #2567

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shiny-chefs-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': minor
---

Fix an issue where the space dropdown was shown under the site sections in Safari.
89 changes: 47 additions & 42 deletions packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function SiteSectionTabs(props: {
<nav
aria-label="Sections"
ref={navRef}
className="flex flex-nowrap items-center mb-px"
className="flex flex-nowrap items-center mb-px max-w-screen-2xl mx-auto page-full-width:max-w-full"
style={
{
'--tab-opacity': `${opacity}`,
Expand All @@ -72,47 +72,52 @@ export function SiteSectionTabs(props: {
} as React.CSSProperties
}
>
<div
className={tcls(
'relative',
'flex',
'gap-2',
'bg-transparent',

// Horizontal padding, which is the layout padding minus the padding of the tabs themselves.
'px-1',
'sm:px-3',
'md:px-5',

/* add a pseudo element for active tab indicator */
'after:block',
"after:content-['']",
'after:origin-left',
'after:absolute',
'after:-bottom-px',
'after:left-0',
'after:opacity-[--tab-opacity]',
'after:scale-x-[--tab-scale]',
'after:[transition:_opacity_150ms_25ms,transform_150ms]',
'after:motion-reduce:transition-none',
'after:translate-x-[var(--tab-start)]',
'after:will-change-transform',
'after:h-0.5',
'after:w-[100px]',
'after:bg-primary',
'dark:after:bg-primary-400',
)}
role="tablist"
>
{tabs.map((tab, index) => (
<Tab
active={currentIndex === index}
key={index + tab.path}
label={tab.label}
href={tab.path}
ref={currentIndex === index ? currentTabRef : null}
/>
))}
<div className="flex flex-col bg-transparent">
{/* An element for the tabs which includes the page padding */}
<div
role="tablist"
className={tcls(
'flex flex-row gap-2',
// Horizontal padding, which is the layout padding minus the padding of the tabs themselves.
'px-1',
'sm:px-3',
'md:px-5',
)}
>
{tabs.map((tab, index) => (
<Tab
active={currentIndex === index}
key={index + tab.path}
label={tab.label}
href={tab.path}
ref={currentIndex === index ? currentTabRef : null}
/>
))}
</div>
{/* A container for a pseudo element for active tab indicator. A container is needed so we can set
a relative position without breaking the z-index of other parts of the header. */}
<div
className={tcls(
'flex',
'relative',
'after:block',
"after:content-['']",
'after:origin-left',
'after:absolute',
'after:-bottom-px',
'after:left-0',
'after:opacity-[--tab-opacity]',
'after:scale-x-[--tab-scale]',
'after:[transition:_opacity_150ms_25ms,transform_150ms]',
'after:motion-reduce:transition-none',
'after:translate-x-[var(--tab-start)]',
'after:will-change-transform',
'after:h-0.5',
'after:w-[100px]',
'after:bg-primary',
'dark:after:bg-primary-400',
)}
></div>
</div>
</nav>
) : null;
Expand Down
Loading