Make WordPress Core

Opened 6 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#65561 closed defect (bug) (fixed)

Styles: preserve important gradient declarations for statu

Reported by: ramonopoly Owned by: ramonopoly
Priority: normal Milestone: 7.1
Component: Editor Version: trunk
Severity: normal Keywords: has-patch has-unit-tests gutenberg-merge
Cc: Focuses:

Description

Problem: State styles currently append !important directly to CSS values before Style Engine sanitization. For gradient values, this can cause safecss_filter_attr() to reject otherwise valid declarations, so responsive/state gradient CSS may not be emitted.

Solution: Store !important as declaration metadata in the Style Engine, preserve it through rule generation and optimization, and append it only after sanitization.

Attachments (1)

65561-preserve-important-gradient-state-declarations.patch (24.0 KB ) - added by sachinrajcp123 6 weeks ago.

Download all attachments as: .zip

Change History (7)

This ticket was mentioned in PR #12361 on WordPress/wordpress-develop by @ramonopoly.


6 weeks ago
#1

Backport of https://github.com/WordPress/gutenberg/pull/79568

## What

State styles currently append !important directly to CSS values before Style Engine sanitization. For gradient values, this can cause safecss_filter_attr() to reject otherwise valid declarations, so responsive/state gradient CSS may not be emitted.

## How
Store !important as declaration metadata in the Style Engine, preserve it through rule generation and optimization, and append it only after sanitization.

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

## Use of AI Tools

AI assistance: Yes
Tool(s): GitHub Copilot, ChatGPT
Model(s): GPT-5.5
Used for: Initial architectural discussion. Unit test scaffolding.

#2 @ramonopoly
6 weeks ago

@sachinrajcp123 this ticket already has a patch on https://github.com/WordPress/wordpress-develop/pull/12361. Your patch looks like a copy of that, so I think we can safely discard it. Thanks.

@wildworks commented on PR #12361:


5 weeks ago
#3

I would appreciate it if you could proceed with this PR and commit it in time for the 7.1 Beta1 release on July 15.

@ramonopoly commented on PR #12361:


4 weeks ago
#4

I'll rebase this after https://github.com/WordPress/wordpress-develop/pull/11384 lands and it should be good to go

#5 @ramonopoly
4 weeks ago

  • Owner set to ramonopoly
  • Resolutionfixed
  • Status newclosed

In 62720:

Style Engine: Preserve important state declarations

Before, state styles appended !important directly to CSS values before Style Engine sanitization. For gradient values, this caused safecss_filter_attr() to reject otherwise valid declarations, so responsive/state gradient CSS might not have been emitted

This commit stores !important as declaration metadata in the Style Engine, preserves it through rule generation and optimization, and appends it only after sanitization.

Props andrewserong, ramonopoly, wildworks.

Fixes #65561.

@ramonopoly commented on PR #12361:


4 weeks ago
#6

Committed in hr62720 / dfff16ff7ef0a06623a35c2aa1743d130b134cc0

Note: See TracTickets for help on using tickets.