WordPress / gutenberg

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

Pattern Inserter: Next #41379

Closed mtias closed 2 years ago

mtias commented 2 years ago

Previously https://github.com/WordPress/gutenberg/issues/21080#issuecomment-605161443


With the focus on "building with patterns" and the expansion of the pattern directory there's a need to refine some flows around the discovery and insertion of patterns. The main things to accommodate are the growing sets of categories and provenance (theme, directory, eventually user); the drag and drop experience when building top level sections; quick browsing between categories; the ability to save, import, and manage.

One proposal from @SaxonF can be a good starting point to make improvements to these area.

To highlight the tasks that could be started:

There's also a few other ideas that can be separated, like the re-addition of a most used / quick blocks as a top row. This is something we can introduce in the main inserter as well. It's also time we make it configurable so you can set 1-4 blocks customized for quick access.

I think this iteration should be focused on patterns and exclude the presence of a "blocks" category. We can try it in the zoomed out view being introduced for the site editor.

See also: #44496


This issue was updated Sep. 28.

Initial explorations ![169957234-20613edf-a7b0-4889-beef-0cc9854c508c](https://user-images.githubusercontent.com/548849/170540279-d5bc5b4e-7210-43c7-9c49-fcb1b89e0fe6.png)
pablohoneyhoney commented 2 years ago

Exciting path! I like the scalability of this model. It's also a good example to explore in motion, and define how the second panel transitions between patterns smoothly as well as how they are dropped and rendered in the canvas.

A few granular notes on the above mock, to address when/where relevant:

SaxonF commented 2 years ago

Inserter @pablohoneyhoney I've updated to utilise existing editor styles, including sidebar spacing of 16px. A couple of small exceptions is a softer border colour, a background colour for menu item hover states, and lighter chevron on menu items. Patterns sidebar could also just be white rather than slightly opaque grey.

https://user-images.githubusercontent.com/1072756/171351475-0c83717f-d7a9-4264-9e3e-de4127b2af71.mp4

Favourites There is future potential to make favourites editable via drag interactions image

Library I just wanted to expand on the idea of the library as well. Your library represents everything you have available to you to craft your site and content. It would contain all block "types", possibly even templates, and allow people to build out and style the lego blocks of their site in isolation. It would live in the same space as the current templates page, eventually next to global styles, navigation etc. I know what's shown here uses light background instead of dark which is worth discussing.

There is room to simplify the mental model surrounding blocks, so the idea of reusable blocks would go away and just become a property of blocks/patterns (maybe all library items are synced by default). It should also differentiate between user created vs others e.g. via sections.

It has the potential to draw in new segments who are more systems focused (e.g. designers, enterprise etc).

You can read some earlier thoughts here.

https://user-images.githubusercontent.com/1072756/171385078-3c473b75-75d3-4edd-9ef3-1609892b171b.mp4

image

https://user-images.githubusercontent.com/1072756/171351486-fe06bcb3-bbd0-4ae8-a55b-3e4dafcd82e4.mp4

pablohoneyhoney commented 2 years ago

Nice!

The library itself could be a separate effort and issue all together. It also opens up a lot of other discussions and changing mental models (like the current synced blocks navigation and management versus being a property, which is interesting).

Re: the pattern inserter itself, I think we lost a bit of focus on the pattern insertion, instead of blocks' (which could remain as is for now). I also appreciated the clarity of the three panels distinguishing them via bg color (white for category listing, grey for pattern stacks, and site color for the canvas).

SaxonF commented 2 years ago

The library itself could be a separate effort and issue all together.

I'd be happy to setup a dedicated issue for this. There are a few separate threads like this and this that are worth pulling together.

the pattern inserter itself, I think we lost a bit of focus on the pattern insertion, instead of blocks

Any thoughts on how to do this without fragmenting the block inserter? I feel pretty strongly that we need to be designing in a way that minimises adding additional complexity to an already complex system/mental model/interface. For this reason I would hesitate to design a pattern insertion experience that differs from blocks, so I'd propose we make changes to the inserter as a whole.

The combination of generic canvas zoom settings, parent element selection on patterns, patterns absorbing child block settings, and removing tabs in the inserter as shown here feels like a great first start point for putting more emphasis on patterns without adding a dedicated mode. A lot of these changes have benefits beyond just patterns as well.

SaxonF commented 2 years ago

Not sold on this approach but you could split patterns out into their own panel so it becomes more of a "quickly access your library" type experience. I still prefer the single inserter approach above though, especially when considering search.

image

jameskoster commented 2 years ago

I think that's essentially how it would work in the mean time, if this feature were introduced as a part of the zoomed out view:

https://user-images.githubusercontent.com/846565/172613128-bea1ba36-43b0-462f-85af-bab3f1167e52.mp4

SaxonF commented 2 years ago

I think it's important block and pattern insertion works the same regardless of how the canvas is presented, at least in core. Zoom to me is really just a zoom setting as opposed to a separate view. Eg I may want to insert blocks while zoomed out or insert patterns while zoomed in.

jameskoster commented 2 years ago

Oh I agree. I was just highlighting that we can potentially try this (in the plugin) in that 'view' since it lends itself to working with patterns already.

paaljoachim commented 2 years ago

I am been thinking even broader. Making a new Media Library where the above is integrated along with media. One would be able to go to the Media library and import/export patterns, template, images etc. Going to any post/page/template to open a kind of Media Library modal with tabs where one could go between various things to add.

Here is a what if rough sketch: https://youtu.be/NJt_94eAERY

jasmussen commented 2 years ago

The work here is inspiring! In the hope that we might be able to take some smaller steps towards this, I tried a couple of remixes to Saxon's design, which feature varying degrees of changes. Potentially one of these might be simpler to implement as a starting point, on to better things.

First, the same general mockup but using mostly unchanged components:

Inserter, base

Secondly, an option that moves the quick shortcuts out of the inserter, and in place of the top left toolbar buttons. You could imagine they expand out and cover the list undo/redo/list view buttons as the inserter close icons spin open:

Inserter, top toolbar shortcuts

Thirdly, an option that keeps the existing tab separation, but still with the new categorization:

Inserter, top toolbar shortcuts-1

The key most important bits remain the split pane design with clear category browsing, as well as the category descriptors in the preview panel.

jameskoster commented 2 years ago

Nice work Joen. I like your first concept because therein blocks and patterns feel like they're on equal footing, which could be important as patterns become more prevalent in different editing flows. It's hard to picture how using the accordions in this context would feel though. Maybe the pattern section should also be collapsible so that you can concentrate on blocks alone? It might be good to prototype.

I do think the tabs could work as well, if we wanted to pursue a more iterative approach.

One minor point on the quick shortcuts: the grey backgrounds could make them look disabled. Do we have icon buttons with this styling elsewhere?

Any thoughts on how these conjoined panels would work on mobile?

jasmussen commented 2 years ago

Definitely seeking an iterative approach here, just to see if any of the wonderful ideas can be extracted to land sooner. Even something like this which keeps the inserter exactly as it is, but adds the split-view & categorized panel could be a starting point:

Inserter, minimal

In saying that, I'm also not discounting any of your feedback on collabsible etc. — just: if we hustle, can we make the patterns tab contents happen for 6.1?

One minor point on the quick shortcuts: the grey backgrounds could make them look disabled. Do we have icon buttons with this styling elsewhere?

Good point. I think, and inspired by Saxon's instincts, that there's value in differentiating them somehow as "block shortcuts". This is another style we could explore:

Inserter, alt style shortcuts

It's a bit more bordered, which adds noise, but it does match the style of buttons we have for "Manage library", and the style switchers in the inspector.

Or maybe the animation that makes these appear (sliding in from the left behind the rotating Inserter → X icon) is sufficient to bring attention to that area changing, making it possible to work as just icon buttons?

Inserter, alt style shortcuts
mtias commented 2 years ago

I like this one:

I wouldn't want to touch how block are presented as that adds a lot more trouble. There's value in bringing the display and browsing improvements to the pattern section first.

The row of block shortcuts in the header is a nice thing to try because it can make quickly adding common items faster yet not intrusive. We need to figure out how we handle focus since right now we move to search first. That might still make the most sense for keyboard nav, with shortcuts being more of a secondary affordance.

jasmussen commented 2 years ago

To those subscribed, this issue has been updated with the mockups to implement.

kohheepeace commented 2 years ago

First of all, sorry if this has already been discussed or requested. Just a request for this issue 👍

1: Hover is better than Select

I think it is better to “hover” each section than to “select” it in order to look for design inspiration.

2022-10-06 04 09 50

Ref: https://shuffle.dev demo page

2: Avoid reloading same pattern multiple times.
Is it possible to avoid re-loading a pattern that has already been loaded?

2022-10-06 04 44 42

[Just an idea to solve]

kevin940726 commented 2 years ago

Is this now implemented in https://github.com/WordPress/gutenberg/pull/44028? Should we close this now, or is there anything else left to implement?

jameskoster commented 2 years ago

I think we can close. If anyone disagrees feel free to reopen 😁

samiff commented 2 years ago

Hi there 👋

In #44028 it looks like the pattern item title was visually hidden:

https://github.com/WordPress/gutenberg/blob/25aa4b41d46d8a8ab9650e79d787a9d09f0dceb3/packages/block-editor/src/components/inserter/style.scss#L314-L316

While that may work well for patterns with a lot of visual variation between them, I'm finding it a step back for patterns that are less visually striking. For example, text based patterns that look very similar to each other are a chore to locate now.

And for third-party pattern additions, I also wonder if it makes it harder in referencing those patterns for users without relying on search (e.g., Navigate to Patterns > Business Templates > ??? )

annezazu commented 2 years ago

@samiff -- mind opening a new issue about this and sharing a few examples? Feel free to @ me in it and I can make sure to get the right labels on it.

mtias commented 2 years ago

@jameskoster I'd still like to try the shortcuts in the main header when the inserter is open for text, image, etc.

mtias commented 2 years ago

We can still keep this close, it's a minor thing!

jameskoster commented 2 years ago

Okay I'll open a separate issue.