Skip to content

Commit e85dce8

Browse files
author
Joen Asmussen
committed
Try sibling inserter tweaks
This PR is based on feedback in #7168. It does this: - It doesn't show the sibling inserter when hovering before the selected block. - It shows the separator line when hovering the plus, never before. This PR is a "try", and if we like it we'd want to make a few further improvements. Like we might actually want to allow showing the sibling inserter _before_ the selected block, if the user has chosen to dock the block toolbar to the top. We might also want to look at improving it further by fading out hover outlines if you're hovering the sibling inserter. We'd need someone like @aduth or @youknowriad's help here.
1 parent 0f981f7 commit e85dce8

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

editor/components/block-list/insertion-point.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class BlockInsertionPoint extends Component {
6464
onFocus={ this.onFocusInserter }
6565
onBlur={ this.onBlurInserter }
6666
/>
67+
<div class="editor-block-list__insertion-point-sibling-indicator"></div>
6768
</div>
6869
) }
6970
</div>

editor/components/block-list/style.scss

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@
682682
height: $block-padding * 2; // Matches the whole empty space between two blocks
683683
justify-content: center;
684684

685-
// Show a clickable plus
685+
// Show a clickable plus.
686686
.editor-block-list__insertion-point-button {
687687
margin-top: -4px;
688688
border-radius: 50%;
@@ -695,25 +695,46 @@
695695
box-shadow: none;
696696
}
697697

698+
// Show the sibling inserter indicator when hovering the plus button.
699+
&:hover + .editor-block-list__insertion-point-sibling-indicator {
700+
left: $block-padding;
701+
right: $block-padding;
702+
opacity: 1;
703+
}
698704
}
699705

700-
// Show a line indicator when hovering, but this is unclickable
701-
&:before {
706+
// This is the indicator shown when using the Sibling Inserter.
707+
.editor-block-list__insertion-point-sibling-indicator {
708+
transition: all 0.1s ease-out 0.1s;
702709
position: absolute;
710+
z-index: -1;
703711
top: calc( 50% - #{ $border-width } );
704712
height: 2px;
705-
left: 0;
706-
right: 0;
707-
background: $dark-gray-100;
713+
left: 50%;
714+
right: 50%;
715+
background: $dark-gray-500;
708716
content: '';
717+
opacity: 0;
709718
}
710719

711-
// Hide both the line and button until hovered
720+
// Hide both the line and button until hovered.
712721
opacity: 0;
713722
transition: opacity 0.1s linear 0.1s;
714723

715-
&:hover, &.is-visible {
724+
&:hover,
725+
&.is-visible {
726+
opacity: 1;
727+
}
728+
}
729+
730+
// Don't show the sibling inserter before the selected block.
731+
.edit-post-layout:not( .has-fixed-toolbar ) .is-selected .editor-block-list__insertion-point-inserter {
732+
opacity: 0;
733+
pointer-events: none;
734+
735+
&.is-visible {
716736
opacity: 1;
737+
pointer-events: auto;
717738
}
718739
}
719740

0 commit comments

Comments
 (0)