Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8d68dad
Prevent overscroll bounce for stage and inspector surfaces
himanshupathak95 May 22, 2026
bbdcbd9
Merge branch 'trunk' into fix/78564-boot-layout-overscroll
t-hamano Jun 8, 2026
fae8a0c
Remove vertical layout overscroll block
himanshupathak95 Jun 18, 2026
b0dbdb1
Set background color to mask overscroll jarr
himanshupathak95 Jun 18, 2026
5e1fa80
Merge branch 'trunk' into fix/78564-boot-layout-overscroll
himanshupathak95 Jun 19, 2026
fc64bfe
Revert base styles color approach
himanshupathak95 Jun 26, 2026
945f699
Use wpds token approach and set body bg color
himanshupathak95 Jun 26, 2026
76657e3
Merge branch 'trunk' into fix/78564-boot-layout-overscroll
himanshupathak95 Jun 26, 2026
4df499a
Removed `var(--wpds-color-foreground-content-neutral)` fallback
himanshupathak95 Jun 29, 2026
8b4bc02
Use `--wpds-color-background-surface-neutral-strong` for `#fff` at ro…
himanshupathak95 Jun 29, 2026
ad40bd3
Remove hardcoded #f8f8f8 background override from isRoot ThemeProvider
himanshupathak95 Jun 30, 2026
bfdf045
Use correct background token for body overscroll fix
himanshupathak95 Jun 30, 2026
8b7a7e6
Revert template changes
himanshupathak95 Jul 1, 2026
35414b2
Revert bg override removal in outer TP
himanshupathak95 Jul 1, 2026
566a989
Sync body background in Root to prevent macOS overscroll flash
himanshupathak95 Jul 1, 2026
7be5ef9
Sync body background in RootSinglePage
himanshupathak95 Jul 1, 2026
b935d70
Merge branch 'trunk' into fix/78564-boot-layout-overscroll
himanshupathak95 Jul 1, 2026
ce21d74
Create `use-sync-body-background` utility hook for reuse
himanshupathak95 Jul 2, 2026
4e89ed6
Use the `use-sync-body-background` hook in TP
himanshupathak95 Jul 2, 2026
d108558
Merge branch 'trunk' into fix/78564-boot-layout-overscroll
t-hamano Jul 2, 2026
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
4 changes: 4 additions & 0 deletions packages/boot/src/components/root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import CanvasRenderer from '../canvas-renderer';
import useRouteTitle from '../app/use-route-title';
import { unlock } from '../../lock-unlock';
import type { CanvasData } from '../../store/types';
import useSyncBodyBackground from './use-sync-body-background';
import './style.scss';

const { useLocation, useMatches, Outlet } = unlock( routePrivateApis );
Expand Down Expand Up @@ -60,6 +61,8 @@ export default function Root() {

const themeColors = useMemo( getAdminThemeColors, [] );

const layoutRef = useSyncBodyBackground();

return (
<SlotFillProvider>
<Tooltip.Provider>
Expand All @@ -69,6 +72,7 @@ export default function Root() {
>
<ThemeProvider color={ themeColors }>
<div
ref={ layoutRef }
className={ clsx( 'boot-layout', {
'has-canvas': !! canvas || canvas === null,
'has-full-canvas': isFullScreen,
Expand Down
4 changes: 4 additions & 0 deletions packages/boot/src/components/root/single-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import SavePanel from '../save-panel';
import CanvasRenderer from '../canvas-renderer';
import { unlock } from '../../lock-unlock';
import type { CanvasData } from '../../store/types';
import useSyncBodyBackground from './use-sync-body-background';
import './style.scss';
import useRouteTitle from '../app/use-route-title';

Expand All @@ -44,6 +45,8 @@ export default function RootSinglePage() {

const themeColors = useMemo( getAdminThemeColors, [] );

const layoutRef = useSyncBodyBackground();

return (
<SlotFillProvider>
<ThemeProvider
Expand All @@ -52,6 +55,7 @@ export default function RootSinglePage() {
>
<ThemeProvider color={ themeColors }>
<div
ref={ layoutRef }
className={ clsx(
'boot-layout boot-layout--single-page',
{
Expand Down
41 changes: 41 additions & 0 deletions packages/boot/src/components/root/use-sync-body-background.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* WordPress dependencies
*/
import { useRef } from '@wordpress/element';
import { useIsomorphicLayoutEffect } from '@wordpress/compose';

/**
* Reads the boot layout's computed background-color and mirrors it onto
* `document.body` to avoid a jarring flash on macOS elastic-scroll bounce.
* Snapshots and restores the previous inline value on unmount.
*
* TODO: Once the two top-level `ThemeProvider` instances can be merged, this
* hook can be replaced with a CSS rule on `<body>`.
* See https://github.com/WordPress/gutenberg/pull/78587#discussion_r3481698286
*
* @return Ref to attach to the `.boot-layout` div.
*/
export default function useSyncBodyBackground() {
const layoutRef = useRef< HTMLDivElement | null >( null );

useIsomorphicLayoutEffect( () => {
if ( ! layoutRef.current ) {
return;
}

const body = layoutRef.current.ownerDocument.body;
const bg = getComputedStyle( layoutRef.current ).backgroundColor;
if ( ! bg ) {
return;
}

const previousBackground = body.style.background;
body.style.background = bg;

return () => {
body.style.background = previousBackground;
};
}, [] );

return layoutRef;
}
Loading