Skip to content

Inserter: Try one DataViews browsing UI for the Patterns and Media tabs - #87410

Open
fcoveram wants to merge 14 commits into
WordPress:trunkfrom
fcoveram:try/inserter-narrow-dataviews
Open

fcoveram wants to merge 14 commits into
WordPress:trunkfrom
fcoveram:try/inserter-narrow-dataviews

Conversation

@fcoveram

@fcoveram fcoveram commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What?

Part of #85552. Depends on #87393.

A proof of concept for the inserter panel. The Patterns and Media tabs browse the same way, both built with the work in #87393, which adds two parts to DataViews for narrow panels: DataViews.ViewMenu (a single settings button) and DataViews.FilterTabs (one field shown as tabs).

Both tabs have the same rows, from top to bottom:

  1. Search and the settings button.
  2. Tabs: the pattern categories, or the media types.
  3. The content, in a grid that scrolls inside the panel. An item is inserted with a click, or by dragging it to the canvas.
  4. The footer: the pagination and the tab's own button ("Explore all patterns" or "Open Media Library").

The Blocks tab is not changed.

Why?

#85552 looks at how content is browsed in the inserter panel, where Blocks, Patterns and Media each work differently. The discussion there leans towards a similar experience across the tabs, with a more opinionated DataViews configuration. #87393 proposes that configuration, and this applies it to two of the tabs to see it with real content:

  • Patterns is where the experience changes. Today it is a list of categories that opens a second panel next to the inserter, with a filter menu of its own. Here it is one panel that opens on "All" patterns, with the categories as tabs.
  • Media already shows a DataViews grid, with a source menu and media type tabs built by hand inside the tab. They are replaced by the shared parts, and the experience stays the same.

How?

Patterns

  • One panel in place of the category list and the second panel, on every screen size. It opens on "All", and the patterns can be clicked or dragged right away.
  • The categories are tabs, in today's order.
  • The settings menu holds "Source", with up to four options, ordered from the farthest from the person editing to the closest: "Pattern Directory", "Theme & Plugins", "Site patterns" and "My patterns". There is no "All" option: "Theme & Plugins" is the default, as "Media library" is in the Media tab.
  • "Site patterns" are all the patterns made on the site, by anyone. "My patterns" are the ones the current user made. "My patterns" is offered only while those are some of the site's patterns and not all of them, so a site with a single author doesn't get two options that list the same.
  • The tabs follow the source: they are the categories that source has patterns in. A source without patterns is not offered. This way no choice leads to an empty list.
  • "Type" (synced or not synced) shows for "Site patterns" and "My patterns" only, the sources that have synced patterns.
  • "Site patterns" is a source, in place of the category of the same name. "My patterns" takes the place of the "Author" group of the old filter menu.
  • 20 patterns per page, as in the list this replaces. The filtering and the search ranking are the existing ones.

Media

  • DataViews.ViewMenu replaces the tab's own source menu, and DataViews.FilterTabs replaces its own tabs.
  • "Source" lists "Media library" first, as the default, and then every other registered source.

In both tabs

  • The source, the category, the media type and the pattern type are fields with a list of elements, and the selection is in view.filters. The menu and the tabs are generated from them, as in DataViews: Add a narrow UI to the grid layout #87393.
  • Each tab has its own search, so the search box shared with the Blocks tab is hidden in these two.
  • They use free composition, not the narrow layout option, because each tab needs its own search and footer.

Content from plugins and themes

Nothing in the two tabs is listed by hand. They show what is registered, so what a plugin or a theme adds is there with no further work:

  • Media sources. Each category registered with registerInserterMediaCategory is a source in the menu, in the order it was registered. The menu takes as many as there are, and scrolls. Tested with 13 sources registered from the console.
  • Pattern categories. A category registered with register_block_pattern_category is a tab, under the sources that have patterns in it. The tabs scroll sideways.
  • Patterns. A pattern registered with register_block_pattern shows under "Theme & Plugins", in the tabs of its categories.

What it doesn't cover:

  • A media category can't be grouped with others. The three categories of the media library are grouped as "Media library" by their names, and a category from a plugin is always a source of its own, without tabs.
  • A plugin can't add an item to the settings menu or a tab to the inserter. It couldn't before either.

Open questions

  • The site's own patterns. They are no longer in the first view, and their category is gone: they are reached through "Source" > "Site patterns". Should that be the default when a site has patterns of its own, or should they keep a tab?
  • "My patterns" as a source. It is a part of "Site patterns", next to three sources that never overlap. It is also left out where the editor doesn't know the current user.
  • Many categories. With many categories registered, most tabs are off screen until the row is scrolled.
  • Search. A term typed in the Blocks tab no longer carries over to Patterns, and a search in Patterns no longer shows blocks.
  • Loading. Pagination is kept as it is. Browsing content in the inserter panel #85552 treats pagination or infinite scroll as a later step.

Not done yet:

  • Mobile width and zoom out mode are not tested.
  • The end-to-end tests that go through the old Patterns flow are not updated, and are expected to fail.
  • CategoryTabs and MobileTabNavigation are left unused. The Patterns tab reuses the Media tab's class names, and overrides the aspect ratio of the grid's media so that each preview keeps its height.

Testing Instructions

  1. Open a post and open the block inserter.
  2. Open the Patterns tab. It opens on the "All" tab, with the patterns from "Theme & Plugins".
  3. Click a pattern to insert it. Drag another one to the canvas.
  4. Choose a category tab. Change the page in the footer: the list starts from the top.
  5. Open the settings menu and choose "Pattern Directory". The tabs change to the categories of that source.
  6. Create a pattern: select a block and choose "Create pattern" in its options menu. "Source" now offers "Site patterns", and with it the "Type" options. "My patterns" joins it once the site also has a pattern by another author.
  7. Open the Media tab. Switch between the media type tabs (there is one for each type the library has files of), then choose another source in the settings menu.
  8. To add a source as a plugin would, run this in the browser console. "My plugin" is added to "Source":
wp.data.dispatch( 'core/block-editor' ).registerInserterMediaCategory( {
	name: 'my-plugin',
	labels: { name: 'My plugin', search_items: 'Search my plugin' },
	mediaType: 'image',
	isExternalResource: true,
	fetch: async () => [
		{
			title: 'Mont Blanc',
			url: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg',
			previewUrl: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg',
		},
	],
} );

Testing Instructions for Keyboard

  1. In the Patterns tab, Tab from the search to the settings button and press Enter. The menu opens with focus on its first option, "Pattern Directory".
  2. Press Enter. The source changes, the menu closes and focus returns to the settings button.
  3. Tab to the tabs, move with the arrow keys and press Enter to select one.
  4. Tab to the first pattern and press Enter. The pattern is inserted.

Screenshots or screencast

Patterns

DV.patterns.flow.01.mp4

Media

DV.media.flow.01.mp4

Use of AI Tools

I used Claude Code to write the code and tests in this pull request from my design brief and wireframes, and to draft this description. I made the design decisions and reviewed the result in the editor.

🤖 Generated with Claude Code

fcoveram and others added 14 commits November 25, 2026 10:33
Add two opt-in subcomponents to compose DataViews in narrow,
single-purpose panels such as the block inserter:

- DataViews.ViewMenu: a settings button that opens a menu with the
  filters that work as menu items (a short fixed list, one value at a
  time), sorting, "Reset view" and any extra items.
- DataViews.FilterTabs: one filter shown as minimal tabs above the
  content.

Both are also available in DataViewsPicker. Includes three Storybook
stories (Narrow · Patterns, Narrow · Media, Narrow · Ineligible
filters), documentation and unit tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add a `size` option so the settings button can sit next to a 40px
control, such as the search field of the block inserter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add DataViews.NarrowUI, an alternative to the default UI for narrow
containers. It takes the same data, fields and view, and renders an
opinionated layout with a single settings button in place of the
filters and the view options buttons.

The settings menu now follows the filter each field already defines:
radio items when it takes one value (`is`), checkboxes when it takes
several (`isAny`), for lists of up to 10 options, the same limit after
which the filters UI switches to a searchable list. Long menus move
each group to a submenu.

Replace the Patterns, Media and Ineligible filters stories with a
single Narrow UI story on the content the other stories use.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Replace the DataViews.NarrowUI subcomponent with a `narrow` prop that
renders the narrow UI in place of the default UI. It is a property of
the UI around the content, so it applies to any layout: table, grid,
list and activity.

In Storybook, the separate Narrow UI story becomes a `narrow` control
in the Layout Table, Layout Grid and Layout List stories.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Move `narrow` from a DataViews prop to an option of the grid layout,
set in `view.layout`. The table and list layouts no longer take it.

Add the same option to the `pickerGrid` layout of DataViewsPicker,
where the footer keeps the selection, the pagination and the actions,
with the actions on a line of their own.

In Storybook, the control stays in the Layout Grid story and is added
to the picker's Default story, in a contained, borderless, full-height
frame like the Layout Activity story.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`onReset` is meant for saved views and comes with the "modified" indicator of the view options button, which the settings button doesn't have. The menu only holds a few groups of options, each with its default one click away, and a consumer that needs a reset item can add it through `children`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A filter left the menu once its list had more than 10 options. A list is often open to extension, such as the sources or categories that plugins register, and a filter that drops out of the menu leaves no way to change it in the narrow UI. A long list now moves to a submenu, which scrolls.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When the menu holds a single group, a submenu only adds a step to reach it. The group now stays in the menu however long it is, and the menu scrolls.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Replace the hand-made source menu and the Tabs wrapper around the grid
with the two DataViews subcomponents for narrow panels.

The source and the media type are modelled as fields with elements, so
they live in `view.filters`. `onChangeView` translates them back to the
tab's existing state, which still decides what the panel fetches.

The menu holds Source and "Reset view". It has no sorting, because a
media request only carries the search term and the page.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Replace the two-step Patterns tab (a list of categories, then a panel of
patterns) with one sidebar built from the same DataViews subcomponents
as the Media tab, so the two tabs browse alike. The tab opens on "All"
patterns.

- The pattern categories are tabs, in today's order.
- Source and Type move to the settings menu, with "Reset view" and a
  link in place of the help paragraph.
- Every pattern inserts on click or with the keyboard, and can be
  dragged onto the canvas.
- Search keeps the existing pattern ranking, within the selected tab.
- DataViews pagination replaces the patterns paging, at the same 20
  per page.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`DataViews.ViewMenu` no longer has a "Reset view" item, and the menu only holds the source, where the default is one click away.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The source has no "All" option: "Theme & Plugins" is the default, and the menu lists it first. The tabs follow the source, showing the categories it has patterns in, and a source without patterns is not offered, so no choice leads to an empty list. The "Type" options show for the "User" source only, the one with synced patterns, and the site's own patterns are that source in place of a tab of their own.

Also removes the "About pattern sources" link and the reset from the menu.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… sources

"User" becomes "Site patterns", and "My patterns" is added after it for the patterns the current user made. It is offered only while those are some of the site's patterns and not all of them, so a site with a single author doesn't get two options listing the same. The sources are ordered from the farthest from the person editing to the closest, with "Theme & Plugins" still the default.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@fcoveram fcoveram added [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Package] Block editor /packages/block-editor labels Nov 25, 2026
@github-actions github-actions Bot added the [Package] DataViews /packages/dataviews label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: fcoveram <fcoveram@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@fcoveram

Copy link
Copy Markdown
Contributor Author

I would love your thoughts on this @andrewserong and @ramonjd

@github-actions
github-actions Bot requested review from aduth and ciampo November 25, 2026 16:59
@andrewserong

Copy link
Copy Markdown
Contributor

Thanks for the ping @fcoveram, lots of cool work here! What kind of feedback are you interested in at this stage? Without having looked at any of the code in this or #87393, a couple of quick impressions:

  • I love the consistency between tabs, and immediately showing patterns in the UI, similar to how what we've done recently for the Media tab makes things more visible and easy to reach at first glance
  • Using Tabs for category navigation feels generally a poor experience to me for users without horizontal scroll on their mouse (which is probably the majority of mouse users outside of Mac users):
2026-11-26.10.06.44.mp4
  • Above, it requires a lot of fine dragging to move across the available categories and click into each. You also can't see at a glance all the categories that are available
  • We'll run into a similar constraint when we get to media folders (what I'm experimenting with in Media: Try an experimental media folders prototype #86414) — where there's potentially going to be a long list of folders that a user can select from, which is a similar need to Pattern categories.
  • So, IMO the tabs are great for when we have a small set of things to switch between, e.g. (Images, Audio, Video, Files), but not suitable when we've got a long list
  • Is there an opportunity to come up with a UI element that handles this "long list of categories" problem that could apply to both Pattern categories and Media folders? The following is just a starting point as an idea, but from the media folders prototype I added a select dropdown so that the user can see all of the categories available:
image

Thanks again for digging in here and working toward coming up with a common pattern for this kind of narrow layout! Another thought is that this doesn't necessarily need to be coupled to Grid as the list beneath the header area could also be a list, potentially? I'm also curious about how much needs to be coupled to DataViews layouts vs just part of how DataViews can be composed, but that's possibly more of a question for #87393 — you make the point there that it's made available through free composition, so that might already answer that part of my question here 🙂

Let us know if there's anything in particular you'd like more detailed thoughts on!

@ramonjd

ramonjd commented Nov 26, 2026

Copy link
Copy Markdown
Member

Patterns is where the experience changes. Today it is a list of categories that opens a second panel next to the inserter, with a filter menu of its own. Here it is one panel that opens on "All" patterns, with the categories as tabs.
Media already shows a DataViews grid, with a source menu and media type tabs built by hand inside the tab. They are replaced by the shared parts, and the experience stays the same.

Thank you for getting this up for testing. 🚀

I don't have much time to dive into it this week. Still, some thoughts came to mind while looking at the screenshot.

Just so I understand, is the main case here consistency (scrolling vs paging) with other screens?

Patterns showing up as soon as the tab opens is I think a worthy improvement.

If they're not already, I thinking that we could prioritize my patterns and site patterns in the list. I'm not sure they're the ones users would reach for the most, I'm only assuming since they'd be the categories closest to the site itself.

Also does search search all or just the selected type?

@fcoveram

Copy link
Copy Markdown
Contributor Author

Sorry for not being enough clear on why the ping. I’m looking for feedback on two things:

  1. Does this idea make sense? Based on your response, I would say we agree with the layout approach where the search input is consistent across the tabs and below it there are filter actions and the content items.
  2. Does it makes sense to use DataViews? Here I can’t conclude from the responses.

Regarding tabs for categories, thanks for the context @andrewserong. I revisited #86414 and I like the idea, but the select with a plus action feels that could be simpler. DataViews offers a way of filtering, but the current design is heavy for this context. I've been playing with an idea and this version feels like a good path.

Patterns tab

Inserter  Patterns flow 02

Media tab

Inserter  Media flow 02

It keeps the filter row permanent and uses Select minimal for each filter criterion. I’m not sure if the above still makes sense as a DataViews enhancement, or if it is composed with other components and the search + filter + content structure is a layout pattern. A ping to @WordPress/gutenberg-components folks asking for their thoughts as this new idea is an alternative to the approach in #87393

Also curious about what @WordPress/gutenberg-design think of this.

Just so I understand, is the main case here consistency (scrolling vs paging) with other screens?

Yes. Just as reported in #85552

Also does search search all or just the selected type?

Just the selected type. The search placeholder could be better communicating this.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Package] Block editor /packages/block-editor [Package] DataViews /packages/dataviews [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants