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

Block: fix invalid block scrim overflowing toolbar on mobile #9473

Merged
merged 5 commits into from
Sep 13, 2018
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
6 changes: 3 additions & 3 deletions packages/editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,13 @@ export class BlockListBlock extends Component {
<BlockHtml clientId={ clientId } />
) }
{ ! isValid && [
<div key="invalid-preview">
{ getSaveElement( blockType, block.attributes ) }
</div>,
<BlockInvalidWarning
key="invalid-warning"
block={ block }
/>,
<div key="invalid-preview">
{ getSaveElement( blockType, block.attributes ) }
</div>,
] }
</BlockCrashBoundary>
{ shouldShowMobileToolbar && (
Expand Down
29 changes: 21 additions & 8 deletions packages/editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
&.has-warning .editor-block-list__block-edit::after {
content: "";
position: absolute;
background-color: rgba($light-gray-100, 0.8);
background-color: rgba($light-gray-100, 0.4);

top: -$block-padding;
bottom: -$block-padding;
Expand All @@ -326,6 +326,14 @@
}
}

&.has-warning.is-selected .editor-block-list__block-edit::after {
bottom: ( $block-toolbar-height - $block-padding - $border-width );

@include break-small() {
bottom: -$block-padding;
}
}

// Appender
&.is-typing .editor-block-list__empty-block-inserter,
&.is-typing .editor-block-list__side-inserter {
Expand Down Expand Up @@ -1072,17 +1080,22 @@

.editor-block-list__block .editor-warning {
z-index: z-index(".editor-warning");
position: absolute;
top: -$block-padding - $border-width;
right: -$parent-block-padding - $border-width;
left: -$parent-block-padding - $border-width;
position: relative;

// Position for nested blocks
// Stretch the warning edge to edge.
margin-left: -$parent-block-padding - $border-width;
margin-right: -$parent-block-padding - $border-width;

// Stretch the warning less in nested contexts.
.editor-block-list__block & {
right: -$block-padding - $border-width;
left: -$block-padding - $border-width;
margin-left: -$block-padding - $border-width;
margin-right: -$block-padding - $border-width;
}

// Pull the warning upwards to the edge, and add a negative bottom margin to compensate.
margin-bottom: -$block-padding - $border-width;
transform: translateY(-$block-padding - $border-width);
talldan marked this conversation as resolved.
Show resolved Hide resolved

// Bigger padding on mobile where blocks are edge to edge.
padding: 10px $parent-block-padding;
@include break-small() {
Expand Down