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

Can't cancel creation of Resuable Block #12940

Closed
maddisondesigns opened this issue Dec 17, 2018 · 19 comments · Fixed by #29040
Closed

Can't cancel creation of Resuable Block #12940

maddisondesigns opened this issue Dec 17, 2018 · 19 comments · Fixed by #29040
Assignees
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Feedback Needs general design feedback. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@maddisondesigns
Copy link

Describe the bug
If you accidentally click the Add to Reusable Blocks menu option, there's no Cancel button to allow you to cancel the Creation of the Block.

To Reproduce
Steps to reproduce the behavior:

  1. Select a block
  2. Click the Add to Reusable Blocks menu option and then try and cancel out of that action

Expected behavior
I should be able to cancel the creation of a Reusable Block if I accidentally click that menu option or decide that I no longer want to create a Reusable Block.

Desktop (please complete the following information):

  • macOS Sierra
  • Firefox Quantum 63.0.3
  • WP 5.0.1
@swissspidy
Copy link
Member

Closing as duplicate of #12286 because this was suggested there already.

@swissspidy swissspidy added [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Dec 17, 2018
@paaljoachim
Copy link
Contributor

@swissspidy
@youknowriad
please re-open as we need to create separate issues for each item from my list. #12286

Thanks.

We need the cancel button.

Existing:
screen shot 2019-02-06 at 19 15 49

With a cancel button:
reusable-block-cancel-button

@youknowriad youknowriad reopened this Feb 6, 2019
@youknowriad
Copy link
Contributor

A solution here would be to use a "modal" to give a name for the block before even saving it. I tried this in a custom development at some point, I think it works fairly well.

@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 14, 2020

I was just reminded with using Gutenberg 7.7 that we are still missing the cancel button for Reusable Blocks.

Screen Shot 2020-03-14 at 16 31 43

@youknowriad
Let's get this in..:)
Who should we ping whom has earlier worked on Reusable blocks?

Or is there another iteration of Reusable blocks being worked on these days that this and whatever else needed is being upgraded?

@youknowriad
Copy link
Contributor

I believe this should be fixed with an alternative design. In a personal project, I implemented something close to reusable blocks but before showing the reusable block in place like we do now, I showed a small modal to enter the initial title and potentially fill other informations (icon, description..). A design like that would allow. "canceling", the current design doesn't.

@youknowriad youknowriad added Needs Design Needs design efforts. and removed [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Mar 16, 2020
@mapk
Copy link
Contributor

mapk commented Mar 18, 2020

Here's a quick mockup with the "cancel" button. Ignore the black background. I had trouble with Figma. :)

reusable

@chrisvanpatten
Copy link
Contributor

@youknowriad Any chance that personal project is open source? I'm looking to implement something similar and would be very interested in seeing some prior art.

@youknowriad
Copy link
Contributor

@chrisvanpatten no it's not unfortunately :(

@mapk With this UI (block toolbar ...), it's already a reusable block. The idea I believe here is to propose this modal as soon as you click "Add to Reusable Blocks" before even persisting the reusable block.

@paaljoachim
Copy link
Contributor

paaljoachim commented Mar 24, 2020

In regards to #12009

I notice that clicking Edit one can adjust the permalink. If one changes ones mind and does not want to save then one can just click outside of the area and the open save is automatically closed. The same method can be used for Creating a reusable block, and deciding not create one anyway. One can just click outside of the area.

Click outside this area to cancel saving a reusable block.
Screen Shot 2020-03-24 at 12 00 23

@youknowriad @mapk

@mapk
Copy link
Contributor

mapk commented Mar 24, 2020

The idea I believe here is to propose this modal as soon as you click "Add to Reusable Blocks" before even persisting the reusable block.

I think adding a modal is too much here. I noticed that the keyboard command for "undo" works just fine except it has a flaw. The first undo shows a weird state [block has been deleted or unavailable]. After doing "undo" again, it returns back to the original state.

undo

If we can fix this weird step in the undo process, I'd say we're golden.

@mapk mapk added Needs Dev Ready for, and needs developer efforts and removed Needs Design Needs design efforts. labels Mar 24, 2020
@earnjam
Copy link
Contributor

earnjam commented Mar 26, 2020

The problem here is that the block is already saved from the moment you select "Add to reusable blocks" and you can't really undo it. Doing an undo doesn't delete the block you've already created from the database.

This also leads to the problem of every block having slugs like untitled-reusable-block, untitled-reusable-block-2, untitled-reusable-block-3, etc. We don't currently use those slugs for anything, but they can't be changed after being created either. Even if you were to change the title. See #5152

@paaljoachim
Copy link
Contributor

paaljoachim commented Apr 1, 2020

The issue title could probably be read as
"bug: Reusable block saved before clicking save."

Actionable items.

Clicking "Add to reusable blocks" SHOULD not save a reusable block but instead open the screen to give the option to do so.

Screen Shot 2020-03-30 at 22 38 40

Made using Figma.
Reusable Block toolbar

@paaljoachim
Copy link
Contributor

@earnjam @chrisvanpatten

Is it possible for one of you or someone else to tackle this issue and fix the Reusable Block so we get correct save/cancel?

Thanks.

@mapk
Copy link
Contributor

mapk commented Apr 13, 2020

I think working in a "Cancel" button here which deletes the resuable block would work just fine.

@noisysocks
Copy link
Member

The difficulty with the proposed flow here is that while you're in the intermittent step in between creating the reusable block and saving the block, the post's content will have gone from looking like this:

<!-- wp:paragraph -->
<p>Paragraph 1.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Paragraph 2.</p>
<!-- /wp:paragraph -->

To looking like this:

<!-- wp:paragraph -->
<p>Paragraph 1.</p>
<!-- /wp:paragraph -->

<!-- wp:block /-->

If, at this point, the user saves the post but does not save the reusable block, they will have permanently lost Paragraph 2. This is why, for simplicity's sake, we opted for a flow saves the reusable block immediately.

@noisysocks noisysocks added [Type] Enhancement A suggestion for improvement. Needs Design Needs design efforts. and removed Needs Dev Ready for, and needs developer efforts labels Apr 20, 2020
@paaljoachim
Copy link
Contributor

It seems the next step is to fix the technical hurdle you mentioned @noisysocks
Before a cancel button can be added as suggested above.

@karmatosed karmatosed added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label May 15, 2020
@mapk mapk added Needs Dev Ready for, and needs developer efforts and removed Needs Design Needs design efforts. labels Jul 16, 2020
@paaljoachim
Copy link
Contributor

paaljoachim commented Oct 10, 2020

This issue is still valid.

Creating a reusable block.
One can "convert to regular blocks" which in a way is like a cancel button.
But for clarity it would be helpful to have a cancel button to cancel the creation of the reusable block. Which does the same as "convert to regular blocks"

Create-reusable-block


With an existing reusable block.
Click the edit button.
Notice only a save button is seen.
There is no cancel button.

Reusable-block-no-cancel-btn

@noisysocks @earnjam

@mapk mapk added Needs Design Feedback Needs general design feedback. and removed Needs Dev Ready for, and needs developer efforts labels Oct 12, 2020
@mapk
Copy link
Contributor

mapk commented Oct 12, 2020

Okay, I've returned to take another look at this. So from what I gather, the reusable block creation process needs a cancel button for the primary purpose that it creates stored elements elsewhere in the backend that can't be removed by just converting it back into regular blocks. It differs from all other transforming or grouping processes in that detail.

For example the Group block can group blocks together, and be ungrouped without needing a cancel option because no additional content is created elsewhere in the backend. But when I create a reusable block and convert it back into regular blocks, there remains a Reusable block in the Inserter. And that is the thing we want to avoid from being created if the click was a mistake.

This messaging should then be displayed BEFORE the reusable block shows up on the page. As @youknowriad mentioned above, a modal or notification of sorts is the way to go. Riad, do you have a PR for the work you mentioned above?

Aligning with that concept, Riad, I created this prototype:

reusable

@paaljoachim
Copy link
Contributor

paaljoachim commented Feb 15, 2021

@noisysocks Robert and @youknowriad Riad.
What should we do with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) Needs Design Feedback Needs general design feedback. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants