Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/wp-includes/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 12 additions & 0 deletions tests/phpunit/tests/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<dialog open autofocus>Content</dialog><button type="button" autofocus>Button</button><textarea autofocus>Some content</textarea><div tabindex="0" autofocus>Some content</div>';
$expected = '<dialog open autofocus>Content</dialog><button type="button">Button</button><textarea>Some content</textarea><div tabindex="0">Some content</div>';

$this->assertEqualHTML( $expected, wp_kses_post( $html ) );
}

/**
* Test that Invoker Commands API attributes are preserved on buttons in post content.
*
Expand Down
Loading