Skip to content

Feature : Edit links directly in the Theme Sidebar#76428

Open
Vrishabhsk wants to merge 2 commits intoWordPress:trunkfrom
Vrishabhsk:add/navigation-edit-via-side-editor
Open

Feature : Edit links directly in the Theme Sidebar#76428
Vrishabhsk wants to merge 2 commits intoWordPress:trunkfrom
Vrishabhsk:add/navigation-edit-via-side-editor

Conversation

@Vrishabhsk
Copy link
Contributor

What?

This PR lets you edit navigation links directly from the Site Editor's sidebar navigation list view — no need to click into the canvas anymore.

Why?

Before this change, editing a navigation link in the Site Editor was a bit of a pain. You had to:

  1. Find your navigation menu in the sidebar
  2. Click into the canvas to select the specific link
  3. Use the block toolbar or inspector to make your edits
  4. Go back to the sidebar to continue managing the menu

That's a lot of back-and-forth. Now you can just click "Edit link" right from the options menu in the sidebar, and a familiar Link UI popover pops up for quick editing.

How?

I leveraged the existing LinkUI and LinkControl components that were already being used for newly inserted navigation links. The NavigationLinkUI component now handles two scenarios:

  1. Insert mode — when a new navigation link block is added
  2. Edit mode — when you want to edit an existing link

Both use the same Link UI popover, so the experience is consistent whether you're adding a new link or editing an old one.

Files changed

  • packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js

    • Added the "Edit link" menu item with a pencil icon
    • It only shows up for navigation links and submenus
  • packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js

    • Added state to track which block is being edited
    • Wired everything up so the editing state flows through to the right components
  • packages/block-library/src/navigation/edit/navigation-link-ui.js

    • Extended to work with existing blocks, not just newly inserted ones
    • Cleans up properly when you're done editing (but only removes empty blocks if they were just inserted)
  • packages/block-library/src/navigation-link/link-ui/index.js

    • Added allowAllContentTypes parameter to getSuggestionsQuery()
    • When editing an existing link, search now works across all post types and taxonomies (not just the original link's type)
    • This means you can now link to any CPT from the sidebar link editor

Testing Instructions

  1. Start the development environment: npm run wp-env start
  2. Go to the Site Editor
  3. Open the Navigation sidebar and pick a navigation menu
  4. Click the three-dot menu on any navigation link
  5. You should see Edit link as the first option
  6. Click it and try:
    • Searching for posts/pages (should find all content types)
    • Entering a custom URL
    • Changing the link label
  7. Press Enter or click away to save

Preview

feat.mp4

@github-actions
Copy link

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: Vrishabhsk <vrishabhsk@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.

@github-actions github-actions bot added [Package] Block library /packages/block-library [Package] Edit Site /packages/edit-site labels Mar 12, 2026
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library, [Package] Edit Site.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library, [Package] Edit Site.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Copy link
Contributor

@jeryj jeryj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I haven't done a code review yet, but here's a few behavioral things to change:

  • We shouldn't change the suggestions query work in this PR. That should be done separately and apply to all instances and will be a much larger change. Keep this PR focused just on editing.
  • For the editing experience, look at how Content Only navigation list view editing works. That's how the flow should work.
Content only navigation popover editing

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

Labels

[Package] Block library /packages/block-library [Package] Edit Site /packages/edit-site

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow editing navigation links from Site Editor Navigation

2 participants