Open jeflopodev opened 3 months ago
This is the most similar issue I found while searching on existing issues. https://github.com/WordPress/gutenberg/issues/62218
But are different issues to me. And mine is very specific to the buttons/button blocks. So that's why I created a new one.
EDIT:
I have rewritten the whole post for clarity. And I have added a video.
I was mistaken on how the alignment is really applied. I selected the button
block and I thought the justification and alignment was being applied to the button
items, but it's not the case they're still applied to their parent (the buttons
block). It's now fully explained in the OP.
Description
Toolbar overlapping problems
I wanted to add a button with an icon. So, I have:
Then I have added an inline image (an svg) to the button.
This is the SVG I used:
The edit width toolbar of the inline image is hiding the link button in the block toolbar, so to add a link I must first deselect the inline image, and select the button. After adding the link I'm being completely unable to hide the link edit toolbar that overlaps the block toolbar unless I deselect the block or select another block, so it's impossible to reach those hidden block toolbar buttons that are below without removing the link first. Selecting the button block from the list view doesn't hide the link edit toolbar either.
Oh, and it can be worse, if while having a link you select the inline image:
So, to summarize:
150px
) is correct for the buttons.Button alignment problems
I have selected a button block and I've set the alignment to the middle. So I expected the text of that button, and the icon to be vertically aligned to the middle. But instead, it is aligned to the bottom line of the inline image.
What's happening here ?
The problem is that doesn't matter if you select the "Buttons" block, or one of the "Button" blocks. They both apply the justification and alignment to the "Buttons" block (to their parent and not to their children items). As this video illustrates:
https://github.com/WordPress/gutenberg/assets/679512/5c104c7c-d033-4665-9b34-7e74ccad87a0
So It's not possible to individually adjust the gap of the
button
block items or their alignment.Using the inspector I see that the buttons use
display: inline-block;
What are the solutions I propose ?
Buttons
block from Gutenberg.Button
blocks could/should be "primitive".button
blocks in any other layout blocks (group, stack, row, grid)buttons
block. But IMO this feature doesn't justify forcing a button to forcefully have a parent. On the other hand we could still duplicate buttons.Button
Block should use flexbox instead of inline-block, so we can justify, control gap, and vertically align it's items.Result with this css (the black bar in the image is the admin bar 😅):
If the
Buttons
block is not removed. (Unfortunately IMO) I think then that theButton
blocks should not show the justification and alignment controls if theButton
block doesn't really support alignment.I'm sorry but I lack the coding knowledge that would be necessary to dig further on the "solution".
Step-by-step reproduction instructions
To test the overlapping toolbars:
Stack
block, with a minimum height of ie.25rem
Stack
block, add abuttons
block with textbutton
block and justify it to the center and align it to the middlebutton
block and add a link to the buttonTo test the alignment problem:
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes