Skip to content

Navigation Link: show indicator for legacy links with id but no dynamic binding#78684

Open
BugReportOnWeb wants to merge 1 commit into
WordPress:trunkfrom
BugReportOnWeb:fix/navigation-link-legacy-unbound-id-indicator
Open

Navigation Link: show indicator for legacy links with id but no dynamic binding#78684
BugReportOnWeb wants to merge 1 commit into
WordPress:trunkfrom
BugReportOnWeb:fix/navigation-link-legacy-unbound-id-indicator

Conversation

@BugReportOnWeb
Copy link
Copy Markdown
Contributor

What?

Closes #73305

This PR adds a "(Needs update)" status indicator to navigation link blocks that carry a legacy numeric id attribute but have no kind binding.

Why?

Some older or manually edited navigation links can retain a numeric id without a kind attribute. Since kind is required for the block’s dynamic entity binding, these links will not automatically update if the linked content changes or is removed. Currently, this state is silent and users receive no indication that the link is no longer properly bound.

How?

Detects legacy unbound links with Number.isInteger( id) && ! kind and adds a NeedsUpdateDisplay UI, following the existing InvalidDraftDisplay pattern, to show a "(Needs update)" indicator.

Testing Instructions

  1. Open a post or page containing a Navigation block.
  2. Insert or edit a navigation link block and remove the kind and metadata fields using the Code Editor
  3. Switch back to the visual editor.
  4. Confirm the navigation link displays "(Needs update)" next to the label.
  5. Click the link item and re-select the same page through the link editing UI and confirm kind is added to the block attributes and the indicator disappears..
  6. Confirm fully bound links show no indicator.
Screen.Recording.2026-05-26.at.6.23.55.PM.mov

Screenshots or screencast

Used the following block for testing after removing the kind and metadata attributes:

<!-- wp:navigation-link {"label":"Sample Page","type":"page","id":2,"url":"http://localhost:8888/sample-page/"} /-->
Before After
Screenshot 2026-05-26 at 6 08 25 PM Screenshot 2026-05-26 at 6 07 39 PM

Use of AI Tools

  • ChatGPT for refining the PR description
  • GitHub Copilot for implementation assistance

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label May 26, 2026
@BugReportOnWeb BugReportOnWeb marked this pull request as ready for review May 26, 2026 13:48
@github-actions
Copy link
Copy Markdown

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.

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.

@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: BugReportOnWeb <devasheeshkaul@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show Indicator When a Link Is Not Dynamic but Has an id Attribute

1 participant