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 Gap for the inserter is getting ignored on last elements #55433

Open
hanneslsm opened this issue Oct 18, 2023 · 4 comments
Open

Block Gap for the inserter is getting ignored on last elements #55433

hanneslsm opened this issue Oct 18, 2023 · 4 comments
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Bug An existing feature does not function as intended

Comments

@hanneslsm
Copy link

hanneslsm commented Oct 18, 2023

Description

When I am having a column block and some groups within, I'd like to move the groups around. The column has a block gap, which isn't displayed on the last element when drag & dropping the groups. The inserter should have a padding (= half the block gap).

Step-by-step reproduction instructions

  1. Drag & Drop a block element in a area where a block gap is defined.
  2. Drag & Drop the block to the last element. Watch the block gap.

Screenshots, screen recording, code snippet

Screen.Recording.2023-10-18.at.08.12.20.mp4

Environment info

  • WP 6.3.2
  • GB 16.8.1
  • Custom theme

Please confirm that you have searched existing issues in the repo.

No

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@hanneslsm hanneslsm changed the title Block Gap for the inserter is ignored on the last element Block Gap for the inserter is getting ignored on last elements Oct 18, 2023
@jordesign
Copy link
Contributor

Confirmed this in testing with WP 6.3.2 and TT3

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Feature] Layout Layout block support, its UI controls, and style output. labels Oct 18, 2023
@ramonjd
Copy link
Member

ramonjd commented Oct 19, 2023

Just to confirm, is the expectation that the inbetween inserter line will reflect the block gap value that will take effect after dropping?

If so, it's a tricky one. The inbetween inserter popup is rendered above the block list (under .edit-post-visual-editor) so it's not really context aware.

I had a quick look to see if we could apply some bottom margin to the last-child of a container that has block gap applied when the inserter is being dragged, but couldn't get it to work.

The inbetween inserter has been explicitly given a zero margin:

So the idea is that, if a block container with layout knows that the block inserter is positioned after the last-child we add the relevant blockGap value to the inserter's margin.

But in practice it's not straight forward.

@hanneslsm
Copy link
Author

Just to confirm, is the expectation that the inbetween inserter line will reflect the block gap value that will take effect after dropping?

Not sure if I got this.
Let me rephrase to avoid misunderstandings: The expectation is that via the inserter (blue line) represents already if there is a block gap or not. This works perfectly fine in between elements. But when dropping it below the last element, the inserter tells me that there won't be a gap… but after dropping it "suddenly appears".

I see how this is becoming tricky, especially when considering horizontal blocks.
However, I think that the is inserter is in its core a "preview" on where the blocks can be dropped, so we should aim for the best preview possible.

@ramonjd
Copy link
Member

ramonjd commented Oct 20, 2023

The expectation is that via the inserter (blue line) represents already if there is a block gap or not.

Thanks for the clarification. It's what I understood, but I phrased it poorly, sorry! 👍🏻

I agree with your sentiments in relation to getting the preview state right while dragging, I'm just not sure about the best way to reflect this yet. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants