diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 46cd2c4576c03..d68021c3a8b30 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -158,9 +158,10 @@ 'popover' => true, ), 'dialog' => array( - 'closedby' => true, - 'open' => true, - 'popover' => true, + 'closedby' => true, + 'open' => true, + 'popover' => true, + 'autofocus' => true, ), 'dl' => array(), 'dt' => array(), diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 1afd7e0884a64..f560d88403524 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -2183,6 +2183,18 @@ public function test_wp_kses_main_tag_standard_attributes() { $this->assertEqualHTML( $html, wp_kses_post( $html ) ); } + /** + * Tests that the autofocus attribute is allowed on dialog elements and removed from other focusable elements. + * + * @ticket 65491 + */ + public function test_wp_kses_dialog_autofocus_attribute() { + $html = '