Skip to content

Conversation

@DAreRodz
Copy link
Contributor

@DAreRodz DAreRodz commented Nov 10, 2025

What?

Displays a warning message if router regions are found without a data-wp-interactive attribute.

Why?

As mentioned in #71635 (comment), router regions, even nested inside a data-wp-interactive element, require both data-wp-router-region and data-wp-interactive attributes to be in place. When data-wp-interactive is missing, no warning message is emitted, causing confusion to developers (see #70883 (comment)).

How?

This PR does two things:

  • Exposes the warn util from the Interactivity API as a private API.
  • Uses warn to display a warning message when SCRIPT_DEBUG is true.

Testing Instructions

  1. Go to the site editor.
  2. Modify the homepage template and add the following HTML outside of the Query block.
    <div data-wp-router-region="region-1">Region 1.</div>
    <div data-wp-router-region="region-2">Region 2.</div>
  3. Ensure "Force page reload" is disabled in the Query block.
  4. Visit the homepage.
  5. Open the console.
  6. Hover the "Next Page" link.
  7. Ensure a warning similar to this one appears on the console:
    Page "/?query-1-page=2" contains the following router regions without a 'data-wp-interactive' attribute: "region-1", "region-2".
    
    Elements with a 'data-wp-router-region' directive must also include a 'data-wp-interactive' attribute on the same element in order for these router regions to be updated correctly during navigation.
    

@github-actions
Copy link

Flaky tests detected in 76425f8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19244721875
📝 Reported issues:

@DAreRodz DAreRodz added [Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity /packages/interactivity [Package] Interactivity Router /packages/interactivity-router [Type] Bug An existing feature does not function as intended labels Nov 11, 2025
@DAreRodz DAreRodz marked this pull request as ready for review November 11, 2025 09:37
@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: DAreRodz <darerodz@git.wordpress.org>

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

@DAreRodz DAreRodz marked this pull request as draft November 11, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity Router /packages/interactivity-router [Package] Interactivity /packages/interactivity [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants