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 : Global styles revisions close button overlaps scrollbar #66456

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
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
34 changes: 24 additions & 10 deletions packages/edit-site/src/components/editor-canvas-container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
privateApis as editorPrivateApis,
} from '@wordpress/editor';

/**
* External dependencies
*/
import clsx from 'clsx';

/**
* Internal dependencies
*/
Expand Down Expand Up @@ -46,6 +51,7 @@ function getEditorCanvasContainerTitle( view ) {

function EditorCanvasContainer( {
children,
className,
closeButtonLabel,
onClose,
enableResizing = false,
Expand Down Expand Up @@ -114,7 +120,12 @@ function EditorCanvasContainer( {

return (
<EditorContentSlotFill.Fill>
<div className="edit-site-editor-canvas-container">
<div
className={ clsx(
'edit-site-editor-canvas-container',
className
) }
>
<ResizableEditor enableResizing={ enableResizing }>
{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
<section
Expand All @@ -123,15 +134,18 @@ function EditorCanvasContainer( {
onKeyDown={ closeOnEscape }
aria-label={ title }
>
{ shouldShowCloseButton && (
<Button
size="compact"
className="edit-site-editor-canvas-container__close-button"
icon={ closeSmall }
label={ closeButtonLabel || __( 'Close' ) }
onClick={ onCloseContainer }
/>
) }
<div className="edit-site-editor-canvas-container__header">
<span>{ title }</span>
{ shouldShowCloseButton && (
<Button
size="compact"
className="edit-site-editor-canvas-container__close-button"
icon={ closeSmall }
label={ closeButtonLabel || __( 'Close' ) }
onClick={ onCloseContainer }
/>
) }
</div>
{ childrenWithProps }
</section>
</ResizableEditor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@
.edit-site-layout.is-full-canvas & {
padding: $grid-unit-30 $grid-unit-30 0;
}
}

.edit-site-editor-canvas-container__section {
background: $white; // Fallback color, overridden by JavaScript.
border-radius: $radius-large;
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
transition: all 0.3s; // Match .block-editor-iframe__body transition.
}
&__section {
background: $white; // Fallback color, overridden by JavaScript.
border-radius: $radius-large;
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
transition: all 0.3s; // Match .block-editor-iframe__body transition.
}

.edit-site-editor-canvas-container__close-button {
position: absolute;
right: $grid-unit-10;
top: $grid-unit-10;
z-index: 2;
background: $white;
&__header {
display: flex;
align-items: center;
padding: $grid-unit-10 $grid-unit-10 $grid-unit-10 $grid-unit-20;
font-weight: 500;
}

&__close-button {
margin-left: auto;
}
}
1 change: 1 addition & 0 deletions packages/edit-site/src/components/revisions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function Revisions( { userConfig, blocks } ) {
title={ __( 'Revisions' ) }
closeButtonLabel={ __( 'Close revisions' ) }
enableResizing
className="edit-site-revisions"
>
<Iframe
className="edit-site-revisions__iframe"
Expand Down
1 change: 1 addition & 0 deletions packages/edit-site/src/components/style-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function StyleBook( {
onClose={ onClose }
enableResizing={ enableResizing }
closeButtonLabel={ showCloseButton ? __( 'Close' ) : null }
className="edit-site-style-book"
>
<div
className={ clsx( 'edit-site-style-book', {
Expand Down
Loading