Skip to content

Commit d48926e

Browse files
authored
Fix an issue where the space dropdown was shown under the site sections in Safari. (#2567)
1 parent d843e5e commit d48926e

File tree

2 files changed

+52
-42
lines changed

2 files changed

+52
-42
lines changed

.changeset/shiny-chefs-compare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': minor
3+
---
4+
5+
Fix an issue where the space dropdown was shown under the site sections in Safari.

packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function SiteSectionTabs(props: {
6363
<nav
6464
aria-label="Sections"
6565
ref={navRef}
66-
className="flex flex-nowrap items-center mb-px"
66+
className="flex flex-nowrap items-center mb-px max-w-screen-2xl mx-auto page-full-width:max-w-full"
6767
style={
6868
{
6969
'--tab-opacity': `${opacity}`,
@@ -72,47 +72,52 @@ export function SiteSectionTabs(props: {
7272
} as React.CSSProperties
7373
}
7474
>
75-
<div
76-
className={tcls(
77-
'relative',
78-
'flex',
79-
'gap-2',
80-
'bg-transparent',
81-
82-
// Horizontal padding, which is the layout padding minus the padding of the tabs themselves.
83-
'px-1',
84-
'sm:px-3',
85-
'md:px-5',
86-
87-
/* add a pseudo element for active tab indicator */
88-
'after:block',
89-
"after:content-['']",
90-
'after:origin-left',
91-
'after:absolute',
92-
'after:-bottom-px',
93-
'after:left-0',
94-
'after:opacity-[--tab-opacity]',
95-
'after:scale-x-[--tab-scale]',
96-
'after:[transition:_opacity_150ms_25ms,transform_150ms]',
97-
'after:motion-reduce:transition-none',
98-
'after:translate-x-[var(--tab-start)]',
99-
'after:will-change-transform',
100-
'after:h-0.5',
101-
'after:w-[100px]',
102-
'after:bg-primary',
103-
'dark:after:bg-primary-400',
104-
)}
105-
role="tablist"
106-
>
107-
{tabs.map((tab, index) => (
108-
<Tab
109-
active={currentIndex === index}
110-
key={index + tab.path}
111-
label={tab.label}
112-
href={tab.path}
113-
ref={currentIndex === index ? currentTabRef : null}
114-
/>
115-
))}
75+
<div className="flex flex-col bg-transparent">
76+
{/* An element for the tabs which includes the page padding */}
77+
<div
78+
role="tablist"
79+
className={tcls(
80+
'flex flex-row gap-2',
81+
// Horizontal padding, which is the layout padding minus the padding of the tabs themselves.
82+
'px-1',
83+
'sm:px-3',
84+
'md:px-5',
85+
)}
86+
>
87+
{tabs.map((tab, index) => (
88+
<Tab
89+
active={currentIndex === index}
90+
key={index + tab.path}
91+
label={tab.label}
92+
href={tab.path}
93+
ref={currentIndex === index ? currentTabRef : null}
94+
/>
95+
))}
96+
</div>
97+
{/* A container for a pseudo element for active tab indicator. A container is needed so we can set
98+
a relative position without breaking the z-index of other parts of the header. */}
99+
<div
100+
className={tcls(
101+
'flex',
102+
'relative',
103+
'after:block',
104+
"after:content-['']",
105+
'after:origin-left',
106+
'after:absolute',
107+
'after:-bottom-px',
108+
'after:left-0',
109+
'after:opacity-[--tab-opacity]',
110+
'after:scale-x-[--tab-scale]',
111+
'after:[transition:_opacity_150ms_25ms,transform_150ms]',
112+
'after:motion-reduce:transition-none',
113+
'after:translate-x-[var(--tab-start)]',
114+
'after:will-change-transform',
115+
'after:h-0.5',
116+
'after:w-[100px]',
117+
'after:bg-primary',
118+
'dark:after:bg-primary-400',
119+
)}
120+
></div>
116121
</div>
117122
</nav>
118123
) : null;

0 commit comments

Comments
 (0)