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

Pattern: unable to set name of pattern when creating a pattern from wp-admin/edit.php?post_type=wp_block #59511

Closed
annezazu opened this issue Mar 1, 2024 · 17 comments
Labels
[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 [Type] Regression Related to a regression in the latest release

Comments

@annezazu
Copy link
Contributor

annezazu commented Mar 1, 2024

When going through the pattern creation flow in wp-admin/edit.php?post_type=wp_block (not what's available in the site editor), there is no ability to set a title for the pattern. This is using WordPress 6.5 beta 3. If you use 6.4.3, a title field is available. Below is a video that walks (and talks) you through it:

pattern.title.missing.mp4

This is a regression and something that needs to be fixed for 6.5 so automatically adding to the to do column. Without a name, it becomes much harder to find the pattern you created!

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Mar 1, 2024
@t-hamano
Copy link
Contributor

t-hamano commented Mar 2, 2024

@annezazu This issue should be fixed in WP6.5, right? It seems that it was added to the WP6.6 board, so I would like to move it to the WP6.5 board.

@annezazu
Copy link
Contributor Author

annezazu commented Mar 2, 2024

Ah! Good catch. That was completely accidental (and likely due to me rushing to get this reported) :D

@youknowriad
Copy link
Contributor

Just noting that in the site editor (block themes), the title of the patterns is not available either. So this issue is the result of the unification of the editors.

For me we should either:

  • have the title in both
  • do not have the title at all
  • Maybe have the title in the sidebar or something.

This might require some design input. cc @jasmussen

@youknowriad
Copy link
Contributor

There's also one stop gap solution potentially.

For classic theme, when opening the pattern for creating, we show a specific "sync status" modal. Ideally this modal should be removed at some point but for now, it can be used to set the title as well, similarly to how we set the sync status.

For both of these in the site editor, the modal is shown before going to the editor when creating a pattern.

@jasmussen
Copy link
Contributor

Good one. It seems like the main place to set the pattern title is this one, from the site editor:

Screenshot 2024-03-04 at 09 54 31

There's also, in the site editor, the ellipsis option to rename:

Screenshot 2024-03-04 at 09 55 39

That does seem to be the main motivation for removing the title field in the editor. Though I'd agree with Riad, there needs to be a stop gap solution for other pathways. Is that primarily classic themes? And to Riad's suggestion, do we show that sync modal only for that flow? If yes, then that feels the obvious quick fix to this, since that modal will then conceptually be similar to the "New pattern" modal.

That said, it does seem like an omission to not have an ability to edit the title of the pattern in the editor, so regardless it could be good to have something there. Whether it's an interface that's unified with what we're thinking about for titleless pages or not, something in the inspector yes perhaps. It can even be the same ellipsis menu as shown above, in an ellipsis here:

Screenshot 2024-03-04 at 10 07 37

After all, that inspector panel should eventually be able to absorb this details page:

Screenshot 2024-03-04 at 10 08 13

CC: @jameskoster for awareness.

Speaking of stop-gaps, though, another option could just be to resurface the title field for patterns, always. Visually we could maybe style it a little bit. I'd be happy to collab in a PR with you @youknowriad, to address this? Let me know. Regardless, we need to fix this layout shift:

layout shift

(It's probably margin present on the appender that disappears when replaced with the paragraph.)

@youknowriad
Copy link
Contributor

cc @ntsekouras would you be able to help with this one?

@liviopv
Copy link

liviopv commented Mar 4, 2024

I noticed this as well when working with a customer today. They were used to manage patterns from /wp-admin/edit.php?post_type=wp_block (added #59545 based on the feedback) and they were creating patterns from there, but then they had to go back to the Site Editor to rename each pattern.

Just noting that in the site editor (block themes), the title of the patterns is not available either.

@youknowriad yes, but editing a Pattern from the Site Editor surfaces the Command Palette with the Pattern title and clicking on it will allow users to rename it:

CleanShot 2024-03-04 at 10 44 50@2x

But when starting from wp-admin, the Command Palette doesn't show up:

CleanShot 2024-03-04 at 10 45 43@2x

@youknowriad
Copy link
Contributor

@liviopv Good point, currently the "Document Bar" is not shown in the post editor and it's one other thing we need to unify with the site editor. The command palette is loaded though and can be triggered using the shortcut.

@ntsekouras
Copy link
Contributor

ntsekouras commented Mar 4, 2024

After reading the discussion, IMO we have to:

  1. Add the title field in the modal of wp-admin create flow, similar to the modal in site editor.
  2. Find a solution of renaming in a consistent way in both editors

Regarding the renaming I observed one more difference in the inspector panel, when we have the pattern tab selected. In post editor we show a summary and in site editor we just show the title.

@jasmussen should we show the summary in site editor too? I think we should probably show it in both editors and also add the pattern's name above with either an elipsis menu next to it with the rename action, or follow the same pattern with the summary and have something like Title: ${title name} which is a button that triggers the modal to appear.

Alternatively we could unify the Document bar.

@jasmussen
Copy link
Contributor

should we show the summary in site editor too? I think we should probably show it in both editors and also add the pattern's name above with either an elipsis menu next to it with the rename action, or follow the same pattern with the summary and have something like Title: ${title name} which is a button that triggers the modal to appear.

I'd tend toward unification, and I'd be tempted to just visually polish these up in the canvas, have the features remain, and then look to potentially refactoring them into more permanent locations, such as a new and improved document inspector that would also be available in list views.

@ntsekouras
Copy link
Contributor

@jasmussen sorry but it's not clear to me what is the suggestion for where to place the rename action and whether to add the summary panel in site editor too. Could you clarify?

@jasmussen
Copy link
Contributor

This rename dropdown, currently available in the site editor for each individual pattern:

Screenshot 2024-03-04 at 12 29 20

This could be available here:

Screenshot 2024-03-04 at 12 29 34

just like it is for navigation:

Screenshot 2024-03-04 at 12 30 49

However I could also see those detail drilldown pages being moved in the future, and be absorbed entirely into the fullscreen editor page inspector. So I could also see it being here:

Screenshot 2024-03-04 at 12 29 41

I.e. in that block description field it would be [sync symbol] My lovely pattern [ellipsis menu].

Let me know if that makes sense, I'm juggling a couple of other things otherwise I'd put together a better (than ASCII) mockup.

@youknowriad
Copy link
Contributor

Let's try to split the work needed to two things:

1- Mandatory things for 6.5: Solution could be to show the "title" within the pattern editor.
2- Enhancements post 6.5 (adding UI to details panel, unify document actions, move renaming to the inspector...)

@jasmussen
Copy link
Contributor

I'm happy to collaborate on a branch that simply unhides the title field from the canvas again. I believe I can CSS that up to work well.

@ntsekouras
Copy link
Contributor

I'll open a PR soon and let's continue there to test things out.

@jp-imagines
Copy link

Just noting a temporary workaround for anyone using a classic (non-block) theme: the "code editor" view does still show the title field:

add title field

@youknowriad
Copy link
Contributor

Closing this one for now. Next step for 6.6 is to actually use the site editor page for patters for classic themes.

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 [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
7 participants