Skip to content

Commit

Permalink
Try sibling inserter tweaks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Joen Asmussen authored and jasmussen committed Jun 11, 2018
1 parent 380f7f3 commit 113dc6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions editor/components/block-list/insertion-point.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class BlockInsertionPoint extends Component {
onFocus={ this.onFocusInserter }
onBlur={ this.onBlurInserter }
/>
<div class="editor-block-list__insertion-point-sibling-indicator"></div>
</div>
) }
</div>
Expand Down
31 changes: 23 additions & 8 deletions editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,12 @@
height: $block-padding * 2; // Matches the whole empty space between two blocks
justify-content: center;

// Show a clickable plus
// Don't show the sibling inserter before the selected block.
.is-selected & {
display: none;
}

// Show a clickable plus.
.editor-block-list__insertion-point-button {
margin-top: -4px;
border-radius: 50%;
Expand All @@ -672,24 +677,34 @@
box-shadow: none;
}

// Show the sibling inserter indicator when hovering the plus button.
&:hover + .editor-block-list__insertion-point-sibling-indicator {
left: $block-padding;
right: $block-padding;
opacity: 1;
}
}

// Show a line indicator when hovering, but this is unclickable
&:before {
// This is the indicator shown when using the Sibling Inserter.
.editor-block-list__insertion-point-sibling-indicator {
transition: all 0.1s ease-out 0.1s;
position: absolute;
z-index: -1;
top: calc( 50% - 1px);
height: 2px;
left: 0;
right: 0;
background: $dark-gray-100;
left: 50%;
right: 50%;
background: $dark-gray-500;
content: '';
opacity: 0;
}

// Hide both the line and button until hovered
// Hide both the line and button until hovered.
opacity: 0;
transition: opacity 0.1s linear 0.1s;

&:hover, &.is-visible {
&:hover,
&.is-visible {
opacity: 1;
}
}
Expand Down

0 comments on commit 113dc6f

Please sign in to comment.