iAPI Docs: Add client-side navigation compatibility guide#76242
Draft
iAPI Docs: Add client-side navigation compatibility guide#76242
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds a new documentation page: Client-Side Navigation Compatibility Guide for the Interactivity API.
Why?
Block developers and theme authors need clear guidance on what makes their code compatible with client-side navigation. Without this, developers may unknowingly introduce patterns that break client-side navigation — causing fallbacks to full page reloads or potentially breaking the site, degrading the user experience.
There was no centralized reference for CSN compatibility, nor a checklist that developers could use to verify compatibility before declaring their blocks compatible.
How?
Adds a new document at
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation-compatibility.mdand links it from the Core Concepts README. The guide covers:block.jsonviasupports.interactivity.clientNavigation.wp_unique_id_from_values()as the recommended alternative towp_unique_id()), and selector consistency across navigations.wp_register_script_module()withloadOnClientNavigation.data-wp-keyfor dynamic lists, avoiding DOM mutations outside the Interactivity API (withdata-wp-watchas the escape hatch), and usingattachTofor HTML outside router regions.The guide is written to be useful for both block developers and classic PHP theme/plugin authors.