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: Proper handling when a pattern does not have a title #54693

Closed
5 of 6 tasks
t-hamano opened this issue Sep 21, 2023 · 6 comments · Fixed by #54717
Closed
5 of 6 tasks

Patterns: Proper handling when a pattern does not have a title #54693

t-hamano opened this issue Sep 21, 2023 · 6 comments · Fixed by #54717
Assignees
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Sep 21, 2023

What problem does this address?

When registering a pattern from the Site Editor, it can be registered without a title.

create-pattern

This in itself may need to be prevented, but since the pattern is a type of post, you can create a pattern without a title from post-new.php?post_type=wp_block. Therefore, I think we need to properly handle the assumption that the pattern has no title.

As far as I have encountered, the following problems have occurred in the no-title pattern.

Screenshot

pattern-library

Screenshot

pattern-editor-canvas

Screenshot

delete-pattern

  • When duplicating a pattern, an error occurs.

It turns out that this problem occurs not when the title is empty, but when it doesn't have a category. I have newly reported it as #54729.

Screenshot

duplicate-pattern

Screenshot

export-file

Screenshot

import-pattern

What is your proposed solution?

As for the Javascript error, I think it should be corrected fixed. As far as displaying the title, I think it should have a fallback title, such as "(no title)" or "the pattern".

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Sep 21, 2023
@Mamaduka
Copy link
Member

The template parts require a name. Maybe we should match that behavior.

@t-hamano
Copy link
Contributor Author

Thank you @Mamaduka for submitting #54693, which requires a title to be entered when creating a pattern!

However, once you have created the pattern, you can update the title to empty from the post type list. Doing so will cause the problem again as mentioned in this issue.

However, the following issue has been resolved as the slug is now properly created from the title when creating the pattern.

The post ID is displayed as the title in the pattern detail page or editor canvas

The screencast below explains the problem.

705b249b0fdb1ad1569bbd66eea15c6d.mp4

@Mamaduka
Copy link
Member

Good point. I think we need to provide fallbacks when the title is intentionally removed.

I'll re-open the issue for follow-ups.

@Mamaduka Mamaduka reopened this Sep 22, 2023
@t-hamano
Copy link
Contributor Author

I was just writing the code for that 👍

@t-hamano
Copy link
Contributor Author

When duplicating a pattern, an error occurs.

It turns out that this problem occurs not when the title is empty, but when it doesn't have a category. I have newly reported it as #54729.

@t-hamano
Copy link
Contributor Author

#54731 resolved the remaining problems in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants