Skip to content

Commit 683373b

Browse files
authored
Fix CLS and others (#2536)
1 parent 673ec8f commit 683373b

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

packages/gitbook/src/app/(site)/(content)/[[...pathname]]/page.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,8 @@ export default async function Page(props: {
7777
{withFullPageCover && page.cover ? (
7878
<PageCover as="full" page={page} cover={page.cover} context={contentRefContext} />
7979
) : null}
80-
<div className={tcls('flex', 'flex-row')}>
81-
<PageBody
82-
space={space}
83-
pointer={contentPointer}
84-
contentTarget={contentTarget}
85-
customization={customization}
86-
context={contentRefContext}
87-
page={page}
88-
document={document}
89-
withPageFeedback={
90-
// Display the page feedback in the page footer if the aside is not visible
91-
withPageFeedback && !page.layout.outline
92-
}
93-
/>
80+
{/* We use a flex row reverse to render the aside first because the page is streamed. */}
81+
<div className="flex flex-row-reverse justify-end">
9482
{page.layout.outline ? (
9583
<PageAside
9684
space={space}
@@ -104,6 +92,19 @@ export default async function Page(props: {
10492
context={contentRefContext}
10593
/>
10694
) : null}
95+
<PageBody
96+
space={space}
97+
pointer={contentPointer}
98+
contentTarget={contentTarget}
99+
customization={customization}
100+
context={contentRefContext}
101+
page={page}
102+
document={document}
103+
withPageFeedback={
104+
// Display the page feedback in the page footer if the aside is not visible
105+
withPageFeedback && !page.layout.outline
106+
}
107+
/>
107108
</div>
108109
<React.Suspense fallback={null}>
109110
<PageClientLayout />

packages/gitbook/src/components/Ads/Ad.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function Ad({
114114
}, [visible, zoneId, ignore, placement, mode, siteAdsStatus]);
115115

116116
return (
117-
<div ref={containerRef} className={tcls(style)}>
117+
<div ref={containerRef} className={tcls(style)} data-visual-test="removed">
118118
{ad ? (
119119
<>
120120
{ad}

packages/gitbook/src/components/Cookies/CookiesToast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export function CookiesToast(props: { privacyPolicy?: string }) {
2727

2828
const onUpdateState = (enabled: boolean) => {
2929
setCookiesTracking(enabled);
30-
3130
// Reload the page to take the change in consideration
3231
window.location.reload();
3332
};
@@ -75,6 +74,7 @@ export function CookiesToast(props: { privacyPolicy?: string }) {
7574
)}
7675
</p>
7776
<button
77+
type="button"
7878
onClick={() => setShow(false)}
7979
aria-label={tString(language, 'cookies_close')}
8080
className={tcls(

packages/gitbook/src/components/PageAside/PageAside.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { PageFeedbackForm } from '../PageFeedback';
2525
/**
2626
* Aside listing the headings in the document.
2727
*/
28-
export async function PageAside(props: {
28+
export function PageAside(props: {
2929
space: Space;
3030
site: Site | undefined;
3131
customization: CustomizationSettings | SiteCustomizationSettings;

packages/gitbook/src/components/primitives/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function Button({
7474
}
7575

7676
return (
77-
<button onClick={onClick} className={domClassName}>
77+
<button type="button" onClick={onClick} className={domClassName}>
7878
{children}
7979
</button>
8080
);

0 commit comments

Comments
 (0)