Skip to content

Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content - #84919

Merged
luisherranz merged 8 commits into
trunkfrom
fix/interactivity-router-data-wp-html-regions
Oct 29, 2026
Merged

luisherranz merged 8 commits into
trunkfrom
fix/interactivity-router-data-wp-html-regions

Conversation

@DAreRodz

Copy link
Copy Markdown
Contributor

What?

Follow-up to #84652.

Client-side navigation now ignores router regions inside data-wp-html content and never attaches a region to an element inside that content. A region whose attachTo has no usable target is skipped instead of breaking navigation.

Why?

Since #84652, the content of a data-wp-html element is inert: the runtime doesn't hydrate it or run its directives. The router didn't follow. It scans whole documents for data-wp-router-region, so a region inside a data-wp-html element's fallback, or inside inserted HTML that ends up in a fetched page, was extracted and rendered during navigation. A fallback copy could replace a real region with the same ID, and a region with attachTo inside that content was created anyway.

Separately, when an attachTo selector matched nothing, renderPage() passed null to a WeakMap, which threw and stopped the whole render. An invalid selector threw too.

How?

  • Runtime. parseDirectiveName() is exported from vdom.ts and added to privateApis(). toVdom() is unchanged.
  • Router check. A router-internal closestHtmlDirectiveElement() (packages/interactivity-router/src/html-directive-element.ts) applies toVdom()'s rule from markup alone: inside an interactive region, an element owns its content when it has a data-wp-html entry without a suffix and no data-wp-text, data-wp-each or data-wp-router-region. A unit test compares it with the real toVdom() across directive spellings, so the two can't drift silently.
  • Region discovery. preparePage() and the initial-page attachTo scan skip regions inside that content. A region that carries data-wp-html itself, or sits inside an element where data-wp-html yields, is still a region.
  • attachTo. renderPage() resolves each selector against the live document on every render, including Back and Forward, to the first match that is neither a data-wp-html element nor inside one. With no usable target (no match, only unusable matches, or an invalid selector), the region is left out of that render and the rest of the navigation completes. The cached page isn't changed, so a later render tries again.
  • Docs. The client-side navigation guide, the router README and both changelogs.

Unchanged: a region that is already attached and gets a different attachTo target on a later page is rendered in both targets. This happens on trunk too.

Testing Instructions

  1. npm run test:unit:vitest -- packages/interactivity packages/interactivity-router. Covers region discovery on prepared pages, attachTo resolution and skipping (including Back, Forward and later retries), and the router check's agreement with toVdom().
  2. npm run test:e2e -- test/e2e/specs/interactivity/router-html-regions.spec.ts test/e2e/specs/interactivity/router-regions.spec.ts. Covers fallback copies ignored through navigation and history, a real region still attaching despite a fallback copy, and unchanged behavior for regular regions.
Optional: check it by hand

On a site with Gutenberg, SCRIPT_DEBUG on, and Chrome (no e2e plugins needed):

  1. Create wp-content/mu-plugins/router-manual.php with the PHP snippet below.
  2. As an administrator, publish three pages in this order: Router Attach, Router B, Router A, using their respective test content below in the Code editor. Replace B_URL and ATTACH_URL in Router A with the published pages' URLs before saving.
  3. Before each check, open Router A's published URL directly, open the console, and wait for Ready. Use the Go to… links in the test content, not the theme navigation. The theme's visible heading stays “Router A”; only the marked regions and browser title change.

Checks:

  1. Fallback copy and history. Click Go to B, then browser Back, Forward, Back. trunk: Real A is replaced by a second Fallback copy on the first navigation and never returns through history. This PR: the real region shows Real B, Real A, Real B, Real A; the single Fallback copy stays unchanged.
  2. Target only inside HTML content. Start again from Router A and click Go to Attach. trunk: ATTACHED appears below Inside target, inside the HTML directive's content, including after Back → Forward. This PR: Page Attach and Navigation complete appear, the URL and browser title change to Router Attach, and ATTACHED never appears. Back restores Real A; Forward restores Page Attach without attaching anything. No console error.
  3. Missing target. In Router Attach's Code editor, change #inside-target to #missing and save. Start again from Router A and click Go to Attach. trunk: an uncaught TypeError: Invalid value used as weak map key; Page A and Real A disappear, the status stays Navigating, and the URL and browser title stay on Router A. This PR: the same successful result as check 2, without ATTACHED or an error. Back → Forward still works; then Go to B shows Real B.
  4. Optional: invalid selector. Change Router Attach's selector to [[, save, and repeat check 3. trunk: an uncaught SyntaxError saying [[ is not a valid selector, with the same unfinished navigation. This PR: the same successful result as check 3.

Remove the mu-plugin and test pages when finished.

wp-content/mu-plugins/router-manual.php:

<?php
/** Loads the modules used by the manual router checks. */
add_action( 'wp_enqueue_scripts', function () {
	// Expose both module names to the inline test script's imports.
	wp_register_script_module( 'manual-router', '', array( '@wordpress/interactivity', '@wordpress/interactivity-router' ) );
	wp_enqueue_script_module( 'manual-router' );
	wp_enqueue_script_module( '@wordpress/interactivity' );
	wp_enqueue_script_module( '@wordpress/interactivity-router' );
} );
/**
 * Declares an unresolved server getter so HTML fallbacks stay visible.
 *
 * @param array|null $data Serialized module data.
 * @return array Module data with the pending getter declaration.
 */
add_filter( 'script_module_data_@wordpress/interactivity', function ( $data ) {
	$data = $data ?? array();
	$data['state']['manual-router']['pending'] = new stdClass();
	$data['derivedStateClosures']['manual-router'][] = 'state.pending';
	return $data;
} );

Router Attach:

<!-- wp:html -->
<div data-wp-interactive="manual-router" data-wp-router-region="manual-status"><p>Page Attach</p></div>
<div data-wp-interactive="manual-router" data-wp-router-region='{"id":"manual-overlay","attachTo":"#inside-target"}'><p>ATTACHED</p></div>
<!-- /wp:html -->

Router B:

<!-- wp:html -->
<div data-wp-interactive="manual-router">
  <div data-wp-interactive="manual-router" data-wp-router-region="manual-status"><p>Page B</p></div>
  <div data-wp-interactive="manual-router" data-wp-router-region="manual-main"><p>Real B</p></div>
  <div data-wp-html="state.pending">
    <div data-wp-interactive="manual-router" data-wp-router-region="manual-main"><p>Fallback copy</p></div>
  </div>
</div>
<!-- /wp:html -->

Router A (replace both URL placeholders):

<!-- wp:html -->
<div data-wp-interactive="manual-router">
  <p><a id="to-b" href="B_URL">Go to B</a> | <a id="to-attach" href="ATTACH_URL">Go to Attach</a></p>
  <p id="navigation-status">Loading modules</p>
  <div data-wp-interactive="manual-router" data-wp-router-region="manual-status"><p>Page A</p></div>
  <div data-wp-interactive="manual-router" data-wp-router-region="manual-main"><p>Real A</p></div>
  <div data-wp-html="state.pending">
    <div data-wp-interactive="manual-router" data-wp-router-region="manual-main"><p>Fallback copy</p></div>
    <div id="inside-target">Inside target</div>
  </div>
</div>
<script type="module">
import { store } from '@wordpress/interactivity';
import { actions } from '@wordpress/interactivity-router';
store('manual-router', {});
for (const link of document.querySelectorAll('#to-b, #to-attach')) {
  /** Navigates without reloading and reports completion after the promise resolves. */
  link.onclick = async (event) => {
    event.preventDefault();
    const status = document.getElementById('navigation-status');
    status.textContent = 'Navigating';
    await actions.navigate(link.href);
    status.textContent = 'Navigation complete';
  };
}
document.getElementById('navigation-status').textContent = 'Ready';
</script>
<!-- /wp:html -->

Testing Instructions for Keyboard

Not applicable: no UI changes.

Use of AI Tools

100% of the code, tests, and comments in this PR were autonomously generated by AI and reviewed by @DAreRodz before the PR was opened.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

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

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +223 B (0%)

Total Size: 8.56 MB

📦 View Changed
Filename Size Change
build/modules/interactivity-router/index.min.js 12.6 kB +216 B (+1.75%)
build/modules/interactivity/index.min.js 16 kB +7 B (+0.04%)

717fe65 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric c85c551 trunk % Change
timeToFirstByte 48.1 ms +3.74% -4.89% 49.4 ms +3.64% -6.17% -2.63%
largestContentfulPaint 82 ms +7.32% -7.32% 82 ms +4.88% -2.44% 0%
lcpMinusTtfb 32.15 ms +18.66% -3.73% 32.2 ms +6.83% -4.97% -0.16%
wpBeforeTemplate 24.49 ms +6.12% -4.37% 24.72 ms +7.97% -5.02% -0.93%
wpTemplate 19.19 ms +6.93% -3.13% 19.67 ms +7.07% -4.58% -2.44%
wpTotal 44.41 ms +3.96% -5% 45.67 ms +3.35% -6.59% -2.76%
wpMemoryUsage 7.70 MB +0% -0% 7.67 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric c85c551 trunk % Change
timeToFirstByte 39.6 ms +5.56% -2.78% 40 ms +2.13% -4.63% -1%
largestContentfulPaint 88 ms +4.55% -0% 88 ms +4.55% -0% 0%
lcpMinusTtfb 50.05 ms +1.8% -2% 50.3 ms +3.18% -1.69% -0.5%
wpBeforeTemplate 20.75 ms +5.69% -1.83% 20.99 ms +3.19% -2.62% -1.14%
wpTemplate 15.62 ms +2.43% -3.46% 15.2 ms +4.74% -4.74% 2.76%
wpTotal 36.59 ms +4.7% -2.95% 36.8 ms +2.39% -4.57% -0.57%
wpMemoryUsage 6.40 MB +0% -0% 6.36 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric c85c551 trunk % Change
mediaProcessingJpeg 389.95 ms +1.51% -1.45% 385.94 ms +1.66% -0.76% 1.04%
mediaProcessingAvif 5657.49 ms +0.67% -0.1% 5663.62 ms +0.46% -0.04% -0.11%
mediaProcessingJpegToAvif 3867.43 ms +0.03% -0.13% 3868.02 ms +0.15% -0.24% -0.02%

media-upload

Metric c85c551 trunk % Change
jpegUploadProcessing 1495.22 ms +32.06% -3.63% 1453.12 ms +0.34% -0.21% 2.9%
pngUploadProcessing 230.41 ms +5.8% -2.27% 227.63 ms +4.86% -2.35% 1.22%
largeJpegUploadProcessing 1450.63 ms +0.3% -0.44% 1457.64 ms +1.78% -0.85% -0.48%
multipleImageUploadProcessing 1600.9 ms +0.63% -0.87% 1618.32 ms +28.56% -2.91% -1.08%

post-editor

Metric c85c551 trunk % Change
serverResponse 531.02 ms +7.75% -2.35% 554.36 ms +4.77% -7.39% -4.21%
firstPaint 527.19 ms +1.9% -35.99% 337.32 ms +58.44% -13.68% 56.29%
domContentLoaded 917.72 ms +0.84% -1.12% 939.46 ms +2.68% -0.69% -2.31%
loaded 919.06 ms +0.84% -1.14% 940.88 ms +2.68% -0.71% -2.32%
firstContentfulPaint 533.57 ms +1.44% -1.51% 551.21 ms +2.01% -2.74% -3.2%
firstBlock 3073.68 ms +2.05% -2.84% 3146.35 ms +1.04% -1.2% -2.31%
type 20.52 ms +4.68% -10.96% 18.52 ms +9.4% -4.16% 10.8%
typeWithoutInspector 18.8 ms +4.73% -7.93% 20.31 ms +4.87% -8.62% -7.43%
typeWithTopToolbar 25.31 ms +10.79% -6.48% 25.28 ms +10.36% -4.35% 0.12%
typeContainer 8.73 ms +9.51% -13.97% 9.09 ms +3.96% -5.28% -3.96%
focus 133.85 ms +5.6% -2.66% 122.52 ms +10.39% -3.04% 9.25%
firstFocus 251.03 ms +0% -0% 251.56 ms +0% -0% -0.21%
selectAll 505.74 ms +0.58% -2.79% 490.96 ms +2.28% -1.61% 3.01%
undo 31.65 ms +10.3% -4.3% 32.69 ms +6.3% -5.29% -3.18%
listViewOpen 78.91 ms +4.52% -4.64% 75.5 ms +9.75% -10.03% 4.52%
inserterOpen 42.39 ms +7.97% -5.57% 44.92 ms +6.86% -16.74% -5.63%
inserterHover 12.06 ms +18.16% -4.56% 11.16 ms +13.26% -9.59% 8.06%
inserterSearch 9.27 ms +7.66% -9.71% 8.65 ms +11.21% -7.17% 7.17%
loadPatterns 689.7 ms +3.42% -3.43% 636.26 ms +8.31% -8.21% 8.4%
wpTotal 520.77 ms +7.6% -2.44% 544.02 ms +4.78% -7.58% -4.27%
wpMemoryUsage 14.73 MB +0% -0% 14.72 MB +0% -0% 0.1%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric c85c551 trunk % Change
serverResponse 562.36 ms +3.7% -3.76% 559.65 ms +3.45% -7.01% 0.48%
firstPaint 294.18 ms +10.2% -9.93% 292.4 ms +7.14% -7.09% 0.61%
domContentLoaded 1022.2 ms +1.27% -0.98% 978.64 ms +0.56% -1.99% 4.45%
loaded 1023.75 ms +1.29% -0.95% 980.14 ms +0.53% -1.99% 4.45%
firstContentfulPaint 576.17 ms +3.33% -2.75% 534.36 ms +2.82% -1.86% 7.82%
firstBlock 4435.24 ms +1.12% -0.84% 4172.78 ms +0.88% -1.43% 6.29%
type 22.2 ms +0.27% -2.03% 22.23 ms +7.33% -14.44% -0.13%
navigate 131.22 ms +7.77% -5.85% 139 ms +5.7% -1.84% -5.6%
loadPatterns 1269.91 ms +6.11% -6.52% 1347.77 ms +11.72% -5.76% -5.78%
loadPages 1061.63 ms +3.85% -3.74% 1109.66 ms +5.26% -1.63% -4.33%
wpTotal 552.2 ms +3.78% -3.94% 549.45 ms +3.5% -7.28% 0.5%
wpMemoryUsage 12.77 MB +0% -0% 12.73 MB +0% -0% 0.27%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

717fe65 Run

🏁 Flaky tests

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.

Navigates the items list via UP/DOWN arrow keys in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page Two')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByLabel('Page Two') with timeout 5000ms
  - waiting for getByLabel('Page Two')
    14 × locator resolved to <button type="button" tabindex="-1" aria-pressed="false" id="view-list-0-189-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-189-label" aria-describedby="view-list-0-189-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:146:49
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can be converted to a quote in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  <!-- wp:quote -->
  <blockquote class="wp-block-quote"><!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>e</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ul>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:436:52
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:417:52
can be copied from multi selection in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

@@ -1,18 +1,18 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ul>
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:33:49
does not double up an event React already delivers in /test/e2e/specs/editor/various/editable-root-compat.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: 0

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/editable-root-compat.spec.js:291:5
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByRole('listbox', { name: 'Search results' })
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" getByRole('listbox', { name: 'Search results' }) with timeout 5000ms
  - waiting for getByRole('listbox', { name: 'Search results' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:423:33)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:3
keeps the count of the previewed page when an earlier page answers late @site-editor-v1-only in /test/e2e/specs/site-editor/comments-count.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: 0
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/comments-count.spec.js:80:26
should create paragraph on Enter in quote block in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('option', { name: 'List', exact: true })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:751:67
should create paragraph on split at end and merge back with content in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

  <!-- wp:paragraph -->
  <p></p>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:461:52
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should format text across blocks in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "b",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2219:41
should merge a following sibling list into the outermost list with Delete from a nested item (#77245) in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

@@ -8,11 +8,11 @@
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {
                  "attributes": Object {
-                   "content": "b‸",
+                   "content": "b",
                  },
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
@@ -25,11 +25,11 @@
    },
    Object {
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "‸1",
          },
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2854:41
should remove an anchored list when deleting its last item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -5,11 +5,11 @@
      },
      "innerBlocks": Array [
        Object {
          "attributes": Object {
            "anchor": "item",
-           "content": "x",
+           "content": "",
          },
          "name": "core/list-item",
        },
      ],
      "name": "core/list",

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2961:41
should replace the selection across blocks with an inline image in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "b",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2421:41
should split into two with paragraph and merge lists in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li></li>
  <!-- /wp:list-item -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:502:52
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":22,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8891/wp-content/uploads/2026/10/0e47f42b-0772-4a86-9915-8ba09566c3c3.png" alt="" class="wp-image-22"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

717fe65 Run

@DAreRodz DAreRodz changed the title Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content Oct 16, 2026
@github-actions github-actions Bot added [Package] E2E Tests /packages/e2e-tests [Package] Interactivity /packages/interactivity [Package] Interactivity Router /packages/interactivity-router labels Oct 16, 2026
- Shorten the changelog entries to the length of earlier ones, split
  the router entry into the two fixes it describes, and drop the stray
  period before the PR link.
- README: move the data-wp-html paragraph after the example it was
  separating from its explanation, fix "An element is not usable when
  the selector matches nothing", and state the initial-page attachTo
  exception once instead of inside the first bullet.
- Guide: define "data-wp-html element" by linking to the conflict
  rules instead of restating them, and remove repeated sentences.
- Directive reference: link from "Inert content" to the router docs.
- Comments: make the parseDirectiveName() and
  closestHtmlDirectiveElement() docblocks precise, drop an unrelated
  privateApis() docblock, and reword cryptic comments.
@DAreRodz DAreRodz mentioned this pull request Oct 16, 2026
19 of 24 tasks
@DAreRodz DAreRodz added [Type] Bug An existing feature does not function as intended [Feature] Interactivity API API to add frontend interactivity to blocks. labels Oct 16, 2026
…of order

The runtime logs each warning once per module, so the tests restoring a
region that carries data-wp-html emitted the conflict warning only when
they ran before the test expecting it. CI runs tests shuffled, and both
failed. Check Back in the test that expects the warning instead.
@luisherranz
luisherranz marked this pull request as ready for review October 28, 2026 10:39

@luisherranz luisherranz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks David.

…router-data-wp-html-regions

# Conflicts:
#	packages/interactivity-router/CHANGELOG.md
#	packages/interactivity-router/src/index.ts
#	packages/interactivity/CHANGELOG.md
#	packages/interactivity/src/vdom.ts
@luisherranz
luisherranz enabled auto-merge (squash) October 29, 2026 14:58
@luisherranz
luisherranz merged commit 00c4190 into trunk Oct 29, 2026
90 of 93 checks passed
@luisherranz
luisherranz deleted the fix/interactivity-router-data-wp-html-regions branch October 29, 2026 15:34
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 29, 2026
@luisherranz luisherranz added Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta and removed [Package] E2E Tests /packages/e2e-tests [Feature] Interactivity API API to add frontend interactivity to blocks. labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown

There was a conflict while trying to cherry-pick the commit to the wp/7.2 branch. Please resolve the conflict manually and create a PR to the wp/7.2 branch.

PRs to wp/7.2 are similar to PRs to trunk, but you should base your PR on the wp/7.2 branch instead of trunk.

# Checkout the wp/7.2 branch instead of trunk.
git checkout wp/7.2

# Create a new branch for your PR.
git checkout -b my-branch

# Cherry-pick the commit.
git cherry-pick 00c4190baf8be6dd19e75906a3a617129c935f1e

# Check which files have conflicts.
git status

# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue

# Push the branch to the repository
git push origin my-branch

# Create a PR and set the base to the wp/7.2 branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.

luisherranz added a commit that referenced this pull request Oct 30, 2026
…de data-wp-html content (#84919) (#86059)

* Interactivity API: Expose parseDirectiveName() to internal consumers

* Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content

* Interactivity Router: Document data-wp-html content and unusable attachTo targets

* Interactivity Router: Add the PR number to the changelog entries under Unreleased

* Interactivity Router: Tighten docs, comments and changelog entries

- Shorten the changelog entries to the length of earlier ones, split
  the router entry into the two fixes it describes, and drop the stray
  period before the PR link.
- README: move the data-wp-html paragraph after the example it was
  separating from its explanation, fix "An element is not usable when
  the selector matches nothing", and state the initial-page attachTo
  exception once instead of inside the first bullet.
- Guide: define "data-wp-html element" by linking to the conflict
  rules instead of restating them, and remove repeated sentences.
- Directive reference: link from "Inert content" to the router docs.
- Comments: make the parseDirectiveName() and
  closestHtmlDirectiveElement() docblocks precise, drop an unrelated
  privateApis() docblock, and reword cryptic comments.

* Interactivity Router: Make the data-wp-html region tests independent of order

The runtime logs each warning once per module, so the tests restoring a
region that carries data-wp-html emitted the conflict warning only when
they ran before the test expecting it. CI runs tests shuffled, and both
failed. Check Back in the test that expects the warning instead.

---------


(cherry picked from commit 00c4190)

Co-authored-by: David Arenas <david.arenas@automattic.com>
@t-hamano t-hamano added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 2, 2026
wporg-sync pushed a commit to WordPress/wordpress-develop that referenced this pull request Nov 3, 2026
This updates the pinned commit hash of the Gutenberg repository from `cc75a79186fd23e72eb015d594e82f40c6209eb5` to `c035c1a649ef68f5c1646694cf440df1d7ae6e62` (fixes cherry-picked to the `wp/7.2` branch).

A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@cc75a79...c035c1a

- Components: Use solid brand highlights for popup items (WordPress/gutenberg#84583) (#85848)
- Fix endless sideload loop when the browser can't decode a big image (WordPress/gutenberg#83530)
- Notes: Show reaction picker as a row of emoji (WordPress/gutenberg#85819) (#85892)
- Notes: Add thumbs up and plus reactions (WordPress/gutenberg#85565)
- Notes: Share thread focus recovery across actions (WordPress/gutenberg#85455)
- Core Fields: Prevent extra space between `/` and text in slug input (WordPress/gutenberg#85935)
- Notes: Add search and a status filter to the All Notes sidebar (WordPress/gutenberg#84060)
- Notes: Use the note permission check when deleting a reaction (WordPress/gutenberg#85883)
- [WP 7.2] Math block: Keyboard focus is trapped in the LaTeX field when the formula has an error (WordPress/gutenberg#86032)
- Core fields: Keep the status icon full size when its label wraps (WordPress/gutenberg#85828) (#86050)
- [WP 7.2] ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (WordPress/gutenberg#86060)
- Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content (WordPress/gutenberg#84919) (#86059)
- [WP 7.2] wp-build: Derive CSS module class names from each stylesheet's CSS (WordPress/gutenberg#86062)
- Playlist: Allow track without an attachment ID to render on the frontend (WordPress/gutenberg#83880) (#86158)
- UI: Show only the day number in Calendar day cells (WordPress/gutenberg#86010) (#86183)
- Notes: Tolerate a null comment in the reaction cascade hooks (WordPress/gutenberg#85959)
- Rich Text: Remove stale format boundary when field loses selection (WordPress/gutenberg#86168)
- Notes: Only let a reaction's author delete it (WordPress/gutenberg#85415)
- Writing flow: Fix Arrow Up and Down getting stuck at the edge of the screen (WordPress/gutenberg#85408)
- Try: Run e2e tests in parallel, on one wp-env site per two cores (WordPress/gutenberg#85420)
- Raw handling: Keep shortcodes in text inline (WordPress/gutenberg#85795)
- Fix: Fixes non-breaking space replacement tooltip (WordPress/gutenberg#85777)
- Non-breaking space: Remove non-breaking spaces that would collapse when replaced (WordPress/gutenberg#85873)

Props mamaduka.
See #66340.

git-svn-id: https://develop.svn.wordpress.org/trunk@65225 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 3, 2026
This updates the pinned commit hash of the Gutenberg repository from `cc75a79186fd23e72eb015d594e82f40c6209eb5` to `c035c1a649ef68f5c1646694cf440df1d7ae6e62` (fixes cherry-picked to the `wp/7.2` branch).

A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@cc75a79...c035c1a

- Components: Use solid brand highlights for popup items (WordPress/gutenberg#84583) (#85848)
- Fix endless sideload loop when the browser can't decode a big image (WordPress/gutenberg#83530)
- Notes: Show reaction picker as a row of emoji (WordPress/gutenberg#85819) (#85892)
- Notes: Add thumbs up and plus reactions (WordPress/gutenberg#85565)
- Notes: Share thread focus recovery across actions (WordPress/gutenberg#85455)
- Core Fields: Prevent extra space between `/` and text in slug input (WordPress/gutenberg#85935)
- Notes: Add search and a status filter to the All Notes sidebar (WordPress/gutenberg#84060)
- Notes: Use the note permission check when deleting a reaction (WordPress/gutenberg#85883)
- [WP 7.2] Math block: Keyboard focus is trapped in the LaTeX field when the formula has an error (WordPress/gutenberg#86032)
- Core fields: Keep the status icon full size when its label wraps (WordPress/gutenberg#85828) (#86050)
- [WP 7.2] ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (WordPress/gutenberg#86060)
- Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content (WordPress/gutenberg#84919) (#86059)
- [WP 7.2] wp-build: Derive CSS module class names from each stylesheet's CSS (WordPress/gutenberg#86062)
- Playlist: Allow track without an attachment ID to render on the frontend (WordPress/gutenberg#83880) (#86158)
- UI: Show only the day number in Calendar day cells (WordPress/gutenberg#86010) (#86183)
- Notes: Tolerate a null comment in the reaction cascade hooks (WordPress/gutenberg#85959)
- Rich Text: Remove stale format boundary when field loses selection (WordPress/gutenberg#86168)
- Notes: Only let a reaction's author delete it (WordPress/gutenberg#85415)
- Writing flow: Fix Arrow Up and Down getting stuck at the edge of the screen (WordPress/gutenberg#85408)
- Try: Run e2e tests in parallel, on one wp-env site per two cores (WordPress/gutenberg#85420)
- Raw handling: Keep shortcodes in text inline (WordPress/gutenberg#85795)
- Fix: Fixes non-breaking space replacement tooltip (WordPress/gutenberg#85777)
- Non-breaking space: Remove non-breaking spaces that would collapse when replaced (WordPress/gutenberg#85873)

Props mamaduka.
See #66340.
Built from https://develop.svn.wordpress.org/trunk@65225


git-svn-id: http://core.svn.wordpress.org/trunk@64374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
arshidkv12 pushed a commit to arshidkv12/wordpress-develop that referenced this pull request Nov 21, 2026
This updates the pinned commit hash of the Gutenberg repository from `cc75a79186fd23e72eb015d594e82f40c6209eb5` to `c035c1a649ef68f5c1646694cf440df1d7ae6e62` (fixes cherry-picked to the `wp/7.2` branch).

A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@cc75a79...c035c1a

- Components: Use solid brand highlights for popup items (WordPress/gutenberg#84583) (#85848)
- Fix endless sideload loop when the browser can't decode a big image (WordPress/gutenberg#83530)
- Notes: Show reaction picker as a row of emoji (WordPress/gutenberg#85819) (#85892)
- Notes: Add thumbs up and plus reactions (WordPress/gutenberg#85565)
- Notes: Share thread focus recovery across actions (WordPress/gutenberg#85455)
- Core Fields: Prevent extra space between `/` and text in slug input (WordPress/gutenberg#85935)
- Notes: Add search and a status filter to the All Notes sidebar (WordPress/gutenberg#84060)
- Notes: Use the note permission check when deleting a reaction (WordPress/gutenberg#85883)
- [WP 7.2] Math block: Keyboard focus is trapped in the LaTeX field when the formula has an error (WordPress/gutenberg#86032)
- Core fields: Keep the status icon full size when its label wraps (WordPress/gutenberg#85828) (#86050)
- [WP 7.2] ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (WordPress/gutenberg#86060)
- Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content (WordPress/gutenberg#84919) (#86059)
- [WP 7.2] wp-build: Derive CSS module class names from each stylesheet's CSS (WordPress/gutenberg#86062)
- Playlist: Allow track without an attachment ID to render on the frontend (WordPress/gutenberg#83880) (#86158)
- UI: Show only the day number in Calendar day cells (WordPress/gutenberg#86010) (#86183)
- Notes: Tolerate a null comment in the reaction cascade hooks (WordPress/gutenberg#85959)
- Rich Text: Remove stale format boundary when field loses selection (WordPress/gutenberg#86168)
- Notes: Only let a reaction's author delete it (WordPress/gutenberg#85415)
- Writing flow: Fix Arrow Up and Down getting stuck at the edge of the screen (WordPress/gutenberg#85408)
- Try: Run e2e tests in parallel, on one wp-env site per two cores (WordPress/gutenberg#85420)
- Raw handling: Keep shortcodes in text inline (WordPress/gutenberg#85795)
- Fix: Fixes non-breaking space replacement tooltip (WordPress/gutenberg#85777)
- Non-breaking space: Remove non-breaking spaces that would collapse when replaced (WordPress/gutenberg#85873)

Props mamaduka.
See #66340.

git-svn-id: https://develop.svn.wordpress.org/trunk@65225 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [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.

3 participants