-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Clarify that when the Inserter is open clicking the + button in the top bar will close it again #29759
Conversation
Size Change: +11.7 kB (+1%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
Hey James. I am comparing directly to the Settings gear icon. How we open and close Settings today. Open-close-settings-gear-icon.mp4Comparing to opening and closing Settings.
I am wondering if the tooltip should stay as it is today. Similar to Settings has the tooltip "Settings". |
This makes sense to me. I don't love losing the experience of my content bouncing around when I'm using the Inserter. I would rather it remain open. The only slightly strange thing to me is the + animating to the close button. I'm not sure that's necessary as it deviates from the other panel buttons' open state. I might change the background to black and leave the + icon as is. |
Turning the plus into a cross was immediately what I thought of when reading this issue title, so that's a +1 from me. |
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'm happy to try this, because it's so simple. I left a few comments to address.
label={ | ||
isInserterOpened | ||
? _x( | ||
'Close block inserter', |
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.
Could we replace this with a single "Toggle block inserter" instead of the ternery? That way the label doesn't need to change, which I suspect might be better for screen readers.
|
||
&.is-pressed { | ||
svg { | ||
transform: rotate(45deg); |
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.
If we go and keep this, it might be nice to update the Figma "small x" icon to be more or less identical to the plus as rotated.
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.
Agreed, let's assess in 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 might already be!)
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.
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.
Hah, I bet that when the pixels antialias together the difference is barely perceptible.
Of course that won't be good enough for you or me, because we'll know! But I'm happy to push the vectors once we get to it 😄
) | ||
: _x( | ||
'Add block', | ||
'Generic label for block inserter button' |
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.
Same as before, it seems simpler and safer to have a single "toggle" label.
@@ -81,6 +81,16 @@ body.is-navigation-sidebar-open { | |||
width: $grid-unit-40; | |||
height: $grid-unit-40; | |||
padding: 0; | |||
|
|||
svg { | |||
transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; |
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.
Same as before, include the mixin.
You're getting this test failure:
So it looks like you need to update that test (can probably just search the codebase for |
Let's give that a try 🤞 |
This is what I see: Add-block-Inserter-X.mp4It looks nice with the switch to the X. The panel does not stay open when clicking into the Gutenberg layout area. |
Hey James. @jameskoster |
This is not intended. When you click outside the inserter, it should close, same as if you press Escape, because the inserter traps focus like a modal. The inserter should stay open when you click a block to insert it, or drag and drop it. |
Hi Joen Understand. Here is a comment in relation to keeping the Add block panel open as if it was a sidebar. As the Add block Inserter looks like a sidebar. #22871 (comment) |
Yep, I don't disagree with the basic premise, and it's the reason why the List View stays permanently open. It is, however, a delicate balance that strives to ensure powerful access to inserting block and navigating the canvas for both mouse and screen reader users. It can be revisited, of course, but it's very non-trivial, and probably not something that should block this PR. |
@@ -41,7 +41,7 @@ export async function closeGlobalBlockInserter() { | |||
async function isGlobalInserterOpen() { | |||
return await page.evaluate( () => { | |||
return !! document.querySelector( | |||
'.edit-post-header [aria-label="Add block"].is-pressed, .edit-site-header [aria-label="Add block"].is-pressed' | |||
'.edit-post-header [aria-label="Toggle block inserter"].is-pressed, .edit-site-header [aria-label="Add block"].is-pressed' |
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.
There is a second instance of "Add block" there. (Used for site editor)
@@ -50,7 +50,7 @@ async function isGlobalInserterOpen() { | |||
*/ | |||
export async function toggleGlobalBlockInserter() { | |||
await page.click( | |||
'.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"]' | |||
'.edit-post-header [aria-label="Toggle block inserter"], .edit-site-header [aria-label="Add 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.
There is a second instance of "Add block" there. (Used for site editor)
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.
LGTM 🚀 🚢
Note: It's safe to merge. Performance test will never pass because the tests will always fail on We need to update the tests to be compatible with both this and trunk
since the selectors have been changed.trunk
branch.
@david-szabo97 but it is un-mergeable until all tests pass 😬 |
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'd say it looks good from a design point of view 👍
@@ -41,7 +41,7 @@ export async function closeGlobalBlockInserter() { | |||
async function isGlobalInserterOpen() { | |||
return await page.evaluate( () => { | |||
return !! document.querySelector( | |||
'.edit-post-header [aria-label="Toggle block inserter"].is-pressed, .edit-site-header [aria-label="Toggle block inserter"].is-pressed' | |||
'.edit-post-header [aria-label="Add block"].is-pressed, .edit-site-header [aria-label="Add block"].is-pressed, .edit-post-header [aria-label="Toggle block inserter"].is-pressed, .edit-site-header [aria-label="Toggle block inserter"].is-pressed' |
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.
Can we add a comment explaining why we need both, so future contributors can make good decisions about when to remove.
Trying out @paaljoachim's idea from #22871 to see how it feels. Video demo in both the post editor and the site editor:
inserter.mp4
Suggestions welcome for the context and tooltip label on the button when in close orientation.