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

Patterns: prevent Classic Block from being dragged into a Sync Pattern Block #52132

Open
liviopv opened this issue Jun 29, 2023 · 4 comments
Open
Labels
[Block] Classic Affects the Classic Editor Block [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended

Comments

@liviopv
Copy link

liviopv commented Jun 29, 2023

Description

The Classic Block can't be turned into a pattern, which I assume is an intentional choice. However, it can still be dragged into an existing Synced Pattern Block, allowing the user to save that Pattern with a Classic Block.

In the site editor, the Classic Block will turn into an HTML Block, which makes it more confusing.

Step-by-step reproduction instructions

  1. Insert a Synced Pattern into a page/post/template
  2. Add a Classic Block
  3. Drag the Classic Block into the Synced Pattern using List View

Screenshots, screen recording, code snippet

CleanShot.2023-06-29.at.17.50.08.mp4

Environment info

Gutenberg 16.1, WordPress 6.2.2

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

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Block] Classic Affects the Classic Editor Block [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Jun 29, 2023
@ramonjd
Copy link
Member

ramonjd commented Jul 13, 2023

The Classic Block can't be turned into a pattern, which I assume is an intentional choice. However, it can still be dragged into an existing Synced Pattern Block, allowing the user to save that Pattern with a Classic Block.

In the site editor, the Classic Block will turn into an HTML Block, which makes it more confusing.

Is this a bug or a feature? cc @aaronrobertshaw

I'm wondering if there is a technical reason reason why Classic blocks shouldn't live within a pattern?

@aaronrobertshaw
Copy link
Contributor

Is this a bug or a feature? cc @aaronrobertshaw

Good question @ramonjd.

I'm not aware that we've changed anything in terms of what may or may not be dragged into synced patterns (formerly reusable blocks).

I'd need to take a look at the Classic block but I suspect that it might have reusable: false in its supports config and that's why it can't be converted to a synced pattern. Probably due to its content being HTML rather than blocks?

Following that, it probably then makes sense it would be dropped into an existing pattern as a HTML block. All that is a bit of speculation at the moment so take it with a grain of salt.

This issue has been added to the Patterns tracking issue.

@glendaviesnz
Copy link
Contributor

I have taken this off the 6.3 board. This is an existing issue with 6.2.2 reusable blocks, and it doesn't seem like there is an existing mechanism for stopping a block from being dragged into a specific parent.

The ideal solution would be to have the reverse of the block parent param, eg. notParent to specify a list of blocks a block can't be a child of, but that is a bigger job that won't be possible at this stage in the 6.3 release.

@talldan
Copy link
Contributor

talldan commented Oct 4, 2023

It'd probably be possible to prevent it as part of the general (list view and canvas) drag and drop mechanism, which I think uses the canInsertBlockType selector to check for legality. I'm guessing that selector doesn't check for reusable: false blocks being inserted into a reusable container.

Having said that, this seems like it's not a priority, and I wonder if there's even any harm in it. Would need to find out the original motivation for reusable: false which maybe I knew at one point, but I don't have any idea right now.

It'll show as an HTML block in the site editor as the classic block isn't supported there. The HTML block is used as the freeform handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended
Projects
Status: Todo
Development

No branches or pull requests

6 participants