-
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
Use button block appender on group block #14943
Changes from 4 commits
9c965e5
be263c3
926b2bf
473d62d
c5f27fa
443822c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ describe( 'Group', () => { | |
it( 'can be created using the block inserter', async () => { | ||
await searchForBlock( 'Group' ); | ||
await page.click( '.editor-block-list-item-group' ); | ||
await page.keyboard.type( 'Group block' ); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
|
@@ -25,7 +24,21 @@ describe( 'Group', () => { | |
await clickBlockAppender(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't introduced here, so not necessary to change, but I find that testing the block inserter and the slash inserter as distinct tasks is not something which should be done in tests for individual blocks, but rather specific to those inserter interactions. This could save us a fair amount of effort (and build runtime) to avoid running them for every combination of blocks. |
||
await page.keyboard.type( '/group' ); | ||
await page.keyboard.press( 'Enter' ); | ||
await page.keyboard.type( 'Group block' ); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
|
||
it( 'can have other blocks appended to it using the button appender', async () => { | ||
await searchForBlock( 'Group' ); | ||
await page.click( '.editor-block-list-item-group' ); | ||
|
||
await page.waitForSelector( '.block-editor-button-block-appender' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit concerning to me that we have to wait. Why isn't it immediately available? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm feeling a little bit burned by failing tests and go with the safest option. 😄 I've removed those calls and tests still pass. |
||
await page.click( '.block-editor-button-block-appender' ); | ||
|
||
await page.waitForSelector( '.editor-block-list-item-paragraph' ); | ||
await page.click( '.editor-block-list-item-paragraph' ); | ||
|
||
await page.keyboard.type( 'Group Block with a Paragraph' ); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
|
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.
Thanks @talldan for the quick PR, in testing I wonder if the appender should be hidden if the block is unselected and already contain items, what do people think? the condition could be
What do you think @mapk @jasmussen @mtias
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.
This needs a decision. I'd tend to agree with @youknowriad that I was surprised by how out-of-place the button inserter feels after having inserted an "initial" block (i.e. once it's no longer empty).
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.
Yeah, I think it makes sense to hide it under those conditions. That helps preserve the 1:1 visual relationship to the front end. 👍
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.
Related: #14241 (comment)
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.
Hmm, I've been experimenting with this. I can't quite put a finger on it, but something about it feels not quite right. It's notably hard to follow when and why the appender is visible if the Group does not have a background assigned, or there are Group blocks within or adjacent to one another (similar observation as #14943 (comment)).
You can give it a try at: http://gutenberg.run/14966
Branch: #14966
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.
Great thoughts, thanks for trying that branch, Andrew, and what is this wonderful new gutenberg.run thing!? I love it. Here's what i see:
My very first instinct is that as soon as you've inserted a single block inside the group, we no longer need to use the generic appender for that block. That interface only feels necessary for the setup state. After that, the same interface that every other block uses — press enter or use the sibling inserter, feels sufficient to me. We already have so many many (+) buttons all over the place, we really need to be careful in adding more of them.
What do you think?