-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
In-between Inserter: Show inserter when it doesn't conflict with block toolbar #64229
Conversation
Size Change: +249 B (+0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @digitalex11. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @t-hamano!
// 3. when the __experimentalCaptureToolbars is not enabled | ||
// 4. when the Top Toolbar is not disabled | ||
if ( | ||
getSelectedBlockClientIds().includes( clientId ) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should still show the inserter and maybe hide the block toolbar if it conflicts. It's quite annoying that you can use the in-between inserter above the selected block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for the block toolbar itself to know that it is conflicting with the inserter? My guess is that this needs to be updated, but I don't know how to implement it right now 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, is there no selector for the currently shown indicator that we can add there? Not saying it should be done in this PR, could be a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to simply not show the block toolbar when the inserter is displayed via the isBlockInsertionPointVisible
selector, but this might be a little confusing as the block toolbar will flash frequently:
e57313af381a30cda88d96e477b9a492.mp4
Ideally, the block toolbar should only not appear when there is a visual "conflict", but I don't know how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, should only be hidden when the inserter is above the selected blocks. I believe there's an insertion index and root client ID in the store that we can check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we merge this and follow up with different solutions for "vertical" layouts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure:
Not saying it should be done in this PR, could be a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I will merge this PR 👍
…k toolbar (#64229) Unlinked contributors: digitalex11. Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Fixes #53315
What?
This PR relaxes the conditions under which in-between inserters appear. This will now allow in-between inserters to always appear in the following scenarios:
__experimentalCaptureToolbars
is enabledWhy?
To avoid conflicts with the block toolbar, we don't allow the in-between inserter to appear when hovering above the selected block. However, in the three contexts mentioned above, the inserter will not conflict with the block toolbar.
Testing Instructions
Confirm the following scenarios:
Note: This PR doesn't fix the issue reported in #64222 where the in-between inserter doesn't always appear on wrapped blocks. I think we probably need to update this condition to fix #64222.
Buttons (Horizontal):
Buttons (Vertical):
__experimentalCaptureToolbars
is enabled.Group (Top toolbar disabled):
Group (Top toolbar enabled):
Screenshots or screencast
7bb15f83161ccf07c5204d1b6f9369f4.mp4