Skip to content

KSES: Support autofocus for dialog children - #13298

Open
rootzero00 wants to merge 1 commit into
WordPress:trunkfrom
rootzero00:ticket/65717-autofocus-dialog-children
Open

KSES: Support autofocus for dialog children#13298
rootzero00 wants to merge 1 commit into
WordPress:trunkfrom
rootzero00:ticket/65717-autofocus-dialog-children

Conversation

@rootzero00

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/65717

Summary

Adds context-aware KSES support for the �utofocus attribute on descendants of dialog elements while preserving existing behavior outside the intended dialog context.

Testing

  • PHP lint passes for src/wp-includes/kses.php
  • PHP lint passes for ests/phpunit/tests/kses.php
  • Targeted PHPUnit: 23 tests, 28 assertions, passing
  • Full KSES PHPUnit: 417 tests, 1472 assertions, passing
  • WordPress Coding Standards: passing
  • git diff --check: passing
  • Candidate validated against current trunk with no material intervening overlap found

Use of AI Tools

AI assistance: Yes.

Used for implementation analysis, candidate refinement, validation planning, and test/review assistance. The final implementation and publication candidate were independently validated against the WordPress test and coding-standard toolchain.

@github-actions

github-actions Bot commented Aug 27, 2026

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props raulsalvat, dmsnell.

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

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@dmsnell

dmsnell commented Aug 28, 2026

Copy link
Copy Markdown
Member

I’m nowhere smart enough to understand what these are saying, even after re-reading them multiples times.

If pre_kses changed the normalized input, structural identity is no longer established. Preserve the hook mutation but do not broaden contextual autofocus for this invocation.

Reduces the post-context autofocus allowance to actual dialog scope.

@rootzero00 you want to write what you meant in different wording? What were you trying to convey with these comments?


I’m going to ask for some delay on this, because in #13271 I’m trying to prep a full refactor of wp_kses() to use the HTML API internally, and the shape of this kind of work will likely be significantly simpler after that refactor. In any case, it will be a growing hassle to be making substantial changes to wp_kses() while that work is in place. My hope is to merge something in next week, so the delay is likely less than the normal review delay would be.

@rootzero00

rootzero00 commented Aug 28, 2026 via email

Copy link
Copy Markdown
Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants