Skip to content

Navigation: Surface blocks and variations in Link UI search results#78345

Open
sarthaknagoshe2002 wants to merge 4 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-77074
Open

Navigation: Surface blocks and variations in Link UI search results#78345
sarthaknagoshe2002 wants to merge 4 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-77074

Conversation

@sarthaknagoshe2002
Copy link
Copy Markdown
Contributor

@sarthaknagoshe2002 sarthaknagoshe2002 commented May 15, 2026

What?

Closes #77074 & Closes #76803

This PR enables users to search for and insert allowed inner blocks (such as Site Logo, Search, or Home link) & block variations (like Category Link, Page Link, etc.) directly from the Navigation block's Link UI popover.

It also introduces contextual badges to the dropdown suggestions to help users distinguish between standard links, block variations, and standalone blocks.

Why?

Previously, adding inner blocks or specific entity variations to the Navigation block required a cumbersome, multi-step workflow separated from standard link addition. For example, adding a Home link required knowing to click "Add Block" -> "Browse All" -> Search "Home".
By integrating block and variation search directly into the Link UI's primary search bar, we:

  • Vastly improve the discoverability of specific entity links (Taxonomies, Categories, Home Link).
  • Reduce cognitive load by keeping the user in a single, unified search flow.
  • Streamline the overall menu-building experience in the Site Editor.

How?

Uses useSelect to gather all available block types and navigation link variations, and check their insertion permissions. It then filters this list in real-time based on the user's search input and whether the blocks/variation are actually allowed within the Navigation menu. Finally, it passes these matching blocks/variation down into the LinkUITools component, which loops through the results to display clickable insertion buttons for the user.

Introduces a getVariationBadgeLabel helper to dynamically generate right-aligned badges (e.g., "Category Link", "Block", "Taxonomy") for the search results, ensuring users know exactly what type of item they are inserting.

Testing Instructions

  1. Add a Navigation block to the editor and hover to reveal the + appender icon.
  2. Click the + to open the Link UI popover.
  3. Test Block Search: Type "Home" into the focused search input field. Verify the "Home Link" block appears with a "Block" badge, and clicking it successfully inserts the block.
  4. Test Variation Search: Open a new Link UI popover and type "Category". Verify the "Category Link" variation appears with the appropriate badge, and clicking it inserts a category link block.
  5. Test Context Isolation: Click on the newly inserted Category link to edit it. Type a generic term into the search bar. Verify that generic blocks (like Site Logo or Home) do not appear in the suggestions, as you are now restricted to searching for category entities.

Screenshots or screencast

Before After
image image

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label May 15, 2026
@sarthaknagoshe2002 sarthaknagoshe2002 changed the title Feat: Add block suggestion in navigation appender Navigation: Add block search and insertion from Link UI May 15, 2026
@sarthaknagoshe2002 sarthaknagoshe2002 marked this pull request as ready for review May 15, 2026 14:07
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org>
Co-authored-by: jeryj <jeryj@git.wordpress.org>

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

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Navigation Link Affects the Navigation Link Block labels May 16, 2026
@sarthaknagoshe2002 sarthaknagoshe2002 changed the title Navigation: Add block search and insertion from Link UI Navigation: Surface blocks and variations in Link UI search results May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Navigation Link Affects the Navigation Link Block [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow adding a Home link in navigation item creation Navigation LinkUI: Include blocks and all entity types within search results

2 participants