Skip to content

Missing validation message to custom CSS input #56082

@afercia

Description

@afercia

Description

This appears to be a regression in trunk introduced in #49521

The validation messages for custom CSS introduced in #47132 no longer work.

The validation relied on the 'internal' CSS parser that was removed in #49521 in favor of postCSS.

While I understand the benefit of switching to postCSS, I'm a little surprised such an impactful change has been merged without double checking all the internal usages of the block editor utility transformStyles. For the future, I'd like to recommend to make such changes be reviewed by contributors who have a larger overview and knowledge of the editor features.
Cc @youknowriad @zaguiini @jsnajdr @strarsis

Step-by-step reproduction instructions

  • Go to the Site editor > Styles > More > Additional CSS
  • Add this in the Additional CSS textarea: body {background: red;}
  • Save.
  • Edit the textarea again and remove the closing bracket }.
  • Move focus away from the textarea.
  • Observe no validation message is shown.
  • Observe your browser dev tools console, you should see a message Uncaught CssSyntaxError: <css input>:1:1: Unclosed block
  • Test on WordPress 6.4 and repeat the steps above.
  • Observe that a red 'i" icon appears at the bottom right of the textarea.
  • Observe that hovering the icon, a tooltip appears with an error message.
  • Observe your browser dev tools console, you should see a message like Error while traversing the CSS: Error: undefined:1:22: missing '}'

Screenshots from WordPress 6.4 (expected behavior):

Screenshot 2023-11-13 at 15 24 33

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Package] Block editor/packages/block-editor[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended[Type] RegressionRelated to a regression in the latest release

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions