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

Inserter: sibling insertion point at top of selected block covers up part of block content #8881

Closed
ZebulanStanphill opened this issue Aug 11, 2018 · 5 comments · Fixed by #9229
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Enhancement A suggestion for improvement.

Comments

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Aug 11, 2018

The issue

The markup for the sibling inserter at the top of a block can cover up part of the block content, even when the block is selected and that sibling inserter is not visible.

Pictured here is a Paragraph block with font size set to 8px; the text is almost completely unselectable due to the div that is covering up most of the block content:
image

This issue becomes even more apparent for blocks with custom top/bottom margins or when themes style the core blocks to have smaller vertical margins. Removing the margins that are currently applied by default to all blocks would also expose this issue more; see #8350.

On a related note, I think sibling inserters should come after the content of a block both semantically and visually. You usually want to use a sibling inserter after the current block, not before.

Steps to reproduce

  1. Insert a Paragraph block
  2. Add a single line of text to the Paragraph.
  3. Set the font size of the Paragraph to 8px or less.
  4. Try to select the text to edit it.
  5. Notice how hard it is to select the text.

Related issues and PRs

@chrisvanpatten
Copy link
Contributor

chrisvanpatten commented Aug 21, 2018

So this to me seems like a bug, not an intentional choice. It could be fixed by setting

.editor-block-list__block>.editor-block-list__insertion-point {
  top: -28px;
}

.editor-block-list__insertion-point-inserter {
  top: 0;
}

This basically moves the inserter's container div to be positioned between the two blocks, rather than moving the inserter button itself.

In a quick test, it seems to work without any changes in behavior, other than making the top line of a paragraph block's text accessible, which is the goal.

Tagging in @jasmussen for feedback on that, because I might be missing a very obvious reason the inner div is moved up rather than the insertion-point container :)

@ZebulanStanphill
Copy link
Member Author

@chrisvanpatten Nice! Notably, even with this fix, the sibling inserter itself (as in the clickable button) would still overlap a portion of the bottom of the block no matter what. I reported that in #8883, but that issue was closed as a duplicate of this one.

@jasmussen
Copy link
Contributor

Taking a look. Also CC: @aduth as we chatted yesterday about it being hard to set cursor in text, this is possibly why.

@jasmussen
Copy link
Contributor

Thanks both, good ticket, and thanks for the proposed fix, @chrisvanpatten, though alas this just moves the issue to the bottom of the paragraph instead of the top. But I will investigate and see if I can find a fix.

jasmussen pushed a commit that referenced this issue Aug 22, 2018
This fixes #8881.

The sibling inserter hit area was not centered perfectly between two blocks. This PR fixes that.

Props to @chrisvanpatten for this fix.
@jasmussen
Copy link
Contributor

Actually Chris, you were right and I was wrong. Your fix, plus or minus a few tweaks, I have implemented in #9229 which fixes this. Props!

jasmussen added a commit that referenced this issue Aug 23, 2018
This fixes #8881.

The sibling inserter hit area was not centered perfectly between two blocks. This PR fixes that.

Props to @chrisvanpatten for this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants