#64280 closed defect (bug) (fixed)
Unable to change the lightbox settings of the Image block within Global Styles when KSES is active
| Reported by: | ramonopoly | Owned by: | ramonopoly |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0 |
| Component: | Themes | Version: | 6.4 |
| Severity: | normal | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Cc: | Focuses: |
Description
This ticket corresponds to the bug report in https://github.com/WordPress/gutenberg/issues/73157
When KSES filters are active (via add_action( 'init', 'kses_init_filters' )), valid non-preset settings in Global Styles are being incorrectly filtered out. Specifically:
lightbox.enabledandlightbox.allowEditingfor Image blocks
The issue occurs because remove_insecure_settings() only preserved:
- Presets (from
PRESETS_METADATA) - Indirect CSS properties (from
INDIRECT_PROPERTIES_METADATA)
Step-by-step reproduction instructions
- Enable the KSES filters with add_action( 'init', 'kses_init_filters' );
- Go to Appearance > Editor
- Open the Styles sidebar
- Select "Blocks"
- Select "Image"
- Change the "Enlarge on click" options
- Save the changes
⚠️ Note how the changes are reverted
Change History (9)
This ticket was mentioned in PR #10534 on WordPress/wordpress-develop by @ramonopoly.
8 months ago
#1
#3
@
7 months ago
- Milestone Awaiting Review → 7.0
Was this introduced in trunk (6.9)
Are you asking which milestone this should be?
I've updated it to 7.0. The bug has been around for eons. See:
https://github.com/WordPress/gutenberg/pull/73452#issuecomment-3562566719
#4
@
7 months ago
Oh, I see it's filed under trunk which I thought means that it's introduced in the current unreleased version.
#5
@
7 months ago
- Version trunk → 6.4
Oh, I see it's filed under trunk which I thought means that it's introduced in the current unreleased version.
Oh, that is a very good point.
I think the bug was introduced in 6.4!
https://github.com/WordPress/gutenberg/pull/54509
So the "version" is the affected version. https://make.wordpress.org/core/handbook/contribute/trac/
I get it. I can update.
Thanks for checking.
#6
@
7 months ago
No worries. There's a lot of tickets filed wrongly under trunk I think, I just picked a random one to figure out why :)
@ramonopoly commented on PR #10534:
5 months ago
#7
Rebased. This change should be good for a final test before commit. It's been running on Gutenberg since v22.2
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
A PR to sync https://github.com/WordPress/gutenberg/pull/73452
## Problem
When KSES filters are active (via
add_action( 'init', 'kses_init_filters' )), valid non-preset settings in Global Styles are being incorrectly filtered out. Specifically:lightbox.enabledandlightbox.allowEditingfor Image blocksThe issue occurs because
remove_insecure_settings()only preserved:PRESETS_METADATA)INDIRECT_PROPERTIES_METADATA)All other valid settings were being stripped, even though they're defined in
VALID_SETTINGSand are safe scalar values or arrays.Related Issue: https://github.com/WordPress/gutenberg/issues/73157
## Solution
Added a new
preserve_valid_settings()method andSAFE_SETTINGSconst that work to preserves valid settings.## Testing Instructions
### Manual Testing
add_action( 'init', 'kses_init_filters' );Trac ticket: https://core.trac.wordpress.org/ticket/64280