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

Reduce minimum spacer height to 1px, while still retaining clickable area #25528

Merged
merged 1 commit into from
Sep 24, 2020
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
9 changes: 3 additions & 6 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
.block-editor-block-list__insertion-point {
position: relative;
z-index: z-index(".block-editor-block-list__insertion-point");
margin-top: -$block-padding;
margin-top: -$block-padding * 2;
}

.block-editor-block-list__insertion-point-indicator {
Expand All @@ -386,9 +386,6 @@

justify-content: center;

// Clicks on the inserter are redirected to the nearest tabbable element.
cursor: text;

// Hide the inserter above the selected block.
&.is-inserter-hidden .block-editor-inserter__toggle {
visibility: hidden;
Expand Down Expand Up @@ -419,8 +416,8 @@
padding: 0;

// Special dimensions for this button.
min-width: 24px;
height: 24px;
min-width: $button-size-small;
height: $button-size-small;

&:hover {
color: $white;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $block-inserter-tabs-height: 44px;
padding: 0;
font-family: $default-font;
font-size: $default-font-size;
line-height: $default-line-height;
line-height: 0;

@include break-medium {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/spacer/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { compose, withInstanceId } from '@wordpress/compose';
import { withDispatch } from '@wordpress/data';
import { useState } from '@wordpress/element';

const MIN_SPACER_HEIGHT = 20;
const MIN_SPACER_HEIGHT = 1;
const MAX_SPACER_HEIGHT = 500;

const SpacerEdit = ( {
Expand Down
12 changes: 12 additions & 0 deletions packages/block-library/src/spacer/editor.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
.block-editor-block-list__block[data-type="core/spacer"] {
// This generates an invisible field above the spacer, which makes its minimum clickable-to-select height larger.
&::before {
content: "";
display: block;
position: absolute;
width: 100%;
height: $button-size-small;
transform: translateY(-#{$button-size-small / 2});
}
}

.block-library-spacer__resize-container.has-show-handle {
background: $gray-100;

Expand Down