Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe style css: Add position CSS properties to support position controls in blocks #3865

Closed
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
8 changes: 8 additions & 0 deletions src/wp-includes/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,7 @@ function kses_init() {
* nested `var()` values, and assigning values to CSS variables.
* Added support for `object-fit`, `gap`, `column-gap`, `row-gap`, and `flex-wrap`.
* Extended `margin-*` and `padding-*` support for logical properties.
* @since 6.2.0 Added support for `position`, `top`, `right`, `bottom`, `left` and `z-index` position CSS properties.
*
* @param string $css A string of CSS rules.
* @param string $deprecated Not used.
Expand Down Expand Up @@ -2438,6 +2439,13 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
'overflow',
'vertical-align',

'position',
'top',
'right',
'bottom',
'left',
'z-index',
andrewserong marked this conversation as resolved.
Show resolved Hide resolved

// Custom CSS properties.
'--*',
)
Expand Down
5 changes: 5 additions & 0 deletions tests/phpunit/tests/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,11 @@ public function data_test_safecss_filter_attr() {
'css' => '--?><.%-not-allowed: red;',
'expected' => '',
),
// Position properties introduced in 6.2.
array(
'css' => 'position: sticky;top: 0;left: 0;right: 0;bottom: 0;z-index: 10;',
'expected' => 'position: sticky;top: 0;left: 0;right: 0;bottom: 0;z-index: 10',
),
);
}

Expand Down