WordPress / gutenberg

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

Inserter: Patterns tab state #61320

Open scruffian opened 2 months ago

scruffian commented 2 months ago

What problem does this address?

Since https://github.com/WordPress/gutenberg/pull/61108, there are several conditions under which the patterns tab doesn't display patterns:

  1. There is no block selected
  2. The theme removes support for core block patterns: remove_theme_support( 'core-block-patterns' );
  3. The patterns haven't loaded yet.

In each of these cases we show this message in the patterns tab:

Screenshot 2024-05-02 at 11 48 30

What is your proposed solution?

We should treat each of these situations differently:

  1. We should still show the patterns and just insert them at the end of the content
  2. We show a message to explain why
  3. We show a loading placeholder

It would be useful to have designs for these states. cc @jasmussen @richtabor

jasmussen commented 2 months ago

This issue feels very reminiscent of #60991, enough that if we can do this:

We should still show the patterns and just insert them at the end of the content

It would likely solve both. We might refine this to "nearest insertable location" rather than "at the end". But wouldn't that mainly be the case? And if we can solve this, do we need loading placeholders or messages?

jasmussen commented 2 months ago

CC: @jameskoster

richtabor commented 2 months ago

We could combine these into one no results found view:

CleanShot 2024-05-02 at 09 16 33

CleanShot 2024-05-02 at 09 16 39

There's already a spinner used when pulling results from the block directory.; we could reuse that UX pattern:

CleanShot 2024-05-02 at 09 17 29

As aside, but the Inserter should probably not render a "no results found" and a spinner at the same time.