Skip to content

Interactivity API for WordPress 7.2 #83078

Open

Description

@DAreRodz

Overall Goal

Land an initial version of the data-wp-html directive and a reactive navigation lifecycle for the Interactivity API router in WordPress 7.2.

The data-wp-html directive will add a missing primitive: today there is no supported way to render markup from the store inside an interactive region and have the result reflected reactively. This initial version will ship a directive that renders only values explicitly trusted by application code through asDangerousHTML(), leaving sanitized plain strings for a later version. See #83076 for the full proposal.

The router work gives extenders a supported, reactive way to observe client-side navigations and know what initiated them, replacing the deprecated state.navigation.hasStarted/hasFinished pair. See #80960 for the proposal.

Scope for This Release

  • data-wp-html (v1): the directive and asDangerousHTML() (#83076). Sanitizing plain strings and hydrating directives inside inserted content are explicitly out of scope for this release.
  • Router navigation lifecycle: state.navigating and state.initiator on the core/router store, plus the initiator option for navigate() (#80960).

Tasks

Nice to Have

  • Migrate the Query block's post-navigation focus logic onto the new router state (follow-up named in #80960).

Contributors

Activity

  1. self-assigned this
    on Sep 17, 2026
  2. added
    [Type] IterationScoped iteration of an effort from a tracking issue or overview issue ideally for a major release.
    on Sep 17, 2026
  3. moved this to 📋 Iteration/Tracking Issues in WordPress 7.2 Editor Taskson Sep 20, 2026
  4. luisherranz commented on Sep 22, 2026

    @luisherranz
    Member

    I've opened a pull request that implements the API for the reactive navigation lifecycle proposed here.

  5. nickchomey commented on Sep 22, 2026

    @nickchomey
    Contributor

    Can I ask why #81699 and #81249 are not being planned for inclusion in 7.2? They're relatively small changes that make a very meaningful difference in performance.

    Likewise, #80021 helps simplify binding with input elements. It's a useful and easy thing to add to 7.2

    And, as I mentioned in #83076, #81462 is somewhat of a superset of that functionality that would provide significantly more functionality that is desperately needed in the iAPI

    I'd welcome any discussion related to these features that I worked very hard on for the benefit of all.

  6. luisherranz commented on Sep 23, 2026

    @luisherranz
    Member

    Can I ask why #81669 and #81249 are not being planned for inclusion in 7.2?
    Likewise, #80021 helps simplify binding with input elements. It's a useful and easy thing to add to 7.2

    Sure, we'll evaluate those as well. Thanks Nick!

    (#81669 seems a wrong pr number, though)

  7. nickchomey commented on Sep 27, 2026

    @nickchomey
    Contributor

    Ah, sorry. Was a typo. #81699

    (i've fixed it above as well, just to prevent confusion if people click that before reading this comment)

  8. luisherranz commented on Oct 5, 2026

    @luisherranz
    Member
  9. DAreRodz commented on Oct 5, 2026

    @DAreRodz
    ContributorAuthor

    Merged this PR that implements data-wp-html in the iAPI runtime. Thanks @theaminulai!

    I left a list of follow-ups in the last review.

    I also create a Trac ticket for the PHP part of this directive, and a PR draft for its implementation:


    EDIT: I've updated the issue description to include the list of follow-ups and the PHP part.

  10. luisherranz commented on Oct 6, 2026

    @luisherranz
    Member

    Merged this PR to remove some of the pending deprecations:

  11. luisherranz commented on Oct 13, 2026

    @luisherranz
    Member

    Merged this PR to align directive name validation with WP Core:

  12. DAreRodz commented on Oct 15, 2026

    @DAreRodz
    ContributorAuthor

    I opened this PR that addresses some of the follow-ups required for data-wp-html.

    In particular, these are the fixes contained in the PR:

    • data-wp-html clears the content for undefined and null, and preserves SSRed markup for pending getters.
    • data-wp-htlm is deactivated for elements with data-wp-text, data-wp-each and data-wp-router-region.
    • There was an issue inside getEvaluate with function values that throw, regarding scope restoration. This affected data-wp-html and was fixed as well.
  13. DAreRodz commented on Oct 16, 2026

    @DAreRodz
    ContributorAuthor

    Merged this PR that improves the performance of the internal toVdom() function. Props to @nickchomey.

  14. nickchomey commented on Oct 16, 2026

    @nickchomey
    Contributor

    Is there any reason not to update preact, preact/signals and preact/signals-core to latest minor versions? Theyre a couple years out of date. I just rebased #79872 onto trunk and fixed some issues. All tests pass. We might even consider updating preact signals to v2.11.3 - i did so previously when i opened #79870 and tests passed as well.

  15. nickchomey commented on Oct 17, 2026

    @nickchomey
    Contributor

    I've now merged trunk into all of my PRs. I dont expect the 4th one to be considered for 7.2, but it would be really fantastic if the other 3 could be. I'd really appreciate a review of them, and would be available to discuss any of it any time

    #81462 - i cant express how desperately, urgently this is needed, because data-wp-html is, at best, a half-measure. We NEED to be able to dynamically insert html that contains iAPI directives
    #80021 - helpful/nice to have
    #81249 - would improve performance further
    #82155 - would meaningfully improve ergonomics significantly, reduce amount of JS written and shipped, and is no longer a CSP risk

    @elpuas here's some of the iAPi improvements that I mentioned at wordcamp last week, if you'd like to check them out and voice your support.

  16. courtneyr-dev commented on Nov 4, 2026

    @courtneyr-dev
    Contributor

    Is it expected that data-wp-html keeps the previous page's content after actions.navigate() from @wordpress/interactivity-router? On 7.2-beta4, with the value set on the server through wp_interactivity_as_dangerous_html(), navigating from page A to page B updates the title and the rest of the router region, but the html directive's element still shows A's markup. A full load of B shows B's. Same in Chromium, Firefox and WebKit. Happy to open an issue with a minimal plugin if it isn't intended.

  17. luisherranz commented on Nov 5, 2026

    @luisherranz
    Member

    @courtneyr-dev it's not. I'm working on a PR to solve it.

  18. luisherranz commented on Nov 9, 2026

    @luisherranz
    Member

    I've committed this PR in WordPress Core to align the server processing of data-wp-html with the latest changes in the client hydration:

  19. luisherranz commented on Nov 9, 2026

    @luisherranz
    Member

    I've opened this PR to fix some edge cases in superseded navigations:

  20. luisherranz commented on Nov 9, 2026

    @luisherranz
    Member

    @Mamaduka fixed a test in Gutenberg that was no longer valid after committing r65343:

  21. luisherranz commented on Nov 10, 2026

    @luisherranz
    Member

    Opened PR so that data-wp-html renders a TrustedHTML value after the browser rejected the same markup as a plain string.

  22. luisherranz commented on Nov 10, 2026

    @luisherranz
    Member

    @courtneyr-dev would you mind checking that data-wp-html now properly replaces the regions after actions.navigate() in the next WP 7.2 beta? Thanks!

  23. courtneyr-dev commented on Nov 10, 2026

    @courtneyr-dev
    Contributor

    @luisherranz Checked on 7.2-beta5 with the same minimal plugin from my earlier comment: after actions.navigate() from /?cft=a to /?cft=b, the data-wp-html element now shows page B's content, both directly in the router region and nested (&nest=1). On a 7.2-beta4 copy of the same site it still showed page A's content, so the fix is in Beta 5. This was in Chromium only; I didn't rerun Firefox or WebKit.

    AI assistance: Yes
    Tool(s): Claude Code
    Used for: running the plugin on both builds and drafting this comment. I reviewed the results.

  24. luisherranz commented on Nov 11, 2026

    @luisherranz
    Member

    Perfect, thanks!

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

Metadata

Metadata

Labels

[Feature] Interactivity APIAPI to add frontend interactivity to blocks.[Type] IterationScoped iteration of an effort from a tracking issue or overview issue ideally for a major release.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions