WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.47k stars 4.18k forks source link

Navigation sub-blocks offer Create Template Part option #55521

Open TonyGravagno opened 1 year ago

TonyGravagno commented 1 year ago

Description

I don't think we want the ability to create template blocks from the navigation block. A block pattern would be more useful and will fit with existing constructs.

You can't use a template part as a navigation sub-block. To do so, open a page containing the navigation block. Add the template part with the saved navigation sub-block, reveal the nested component within the template part. Copy the nested component. In the navigation block, add a temporary spacer. Paste from the clipboard onto that temporary block to replace it. It works great. There are many similar ways to do this, but none of them are elegant.

Perhaps the issue is not that we are allowed to save a navigation sub-block as a template part, but that we are not allowed to add a template part back into a navigation block. The add/search dialog has no option to insert a template part into a navigation block. We can add patterns, but we can't use our own block patterns either.

Screenshots 2-3 show no locally-defined patterns, and Explore all Patterns does not include local patterns.

I don't think we want to add template parts into navigation blocks. I think the solution is to change the "Create template part" option to the common "Create pattern/reusable block" option, then under the Add option on the Navigation block, enhance the Browse All list of Patterns to include patterns saved with this feature.

I don't know what the flag is in specific Call To Action blocks that allows only specific CTAs to be added to a Navigation block, but that's the flag that we would want set on new patterns from the nav block.

As an aside, when I do test the "Create template part" option and confirm the save, it does create a template part, but the progress animation on the Create button doesn't stop and the dialog needs to be closed manually. If this ticket is processed, this bug doesn't need to be processed, though a developer might want to look into why that animation might not stop under other conditions.

Step-by-step reproduction instructions

  1. Edit a Navigation block.
  2. Focus on a child block.
  3. Open options
  4. Note the option to "Create template part".

Screenshots, screen recording, code snippet

No response

Environment info

WP 6.3.2 Production without additional Gutenberg plugin.

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

draganescu commented 6 months ago

I have tried to solve this in https://github.com/WordPress/gutenberg/pull/60197 but turns out this behaviour is by design. Since I would say building a special block actions component for the navigation block is a bad idea, I've added the needs design feedback label to help with closing or fixing.