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

[Bug]: Using gutenberg-edge (14.8 rc1) new custom CSS feature doesn't work #71273

Closed
dsas opened this issue Dec 16, 2022 · 14 comments
Closed

[Bug]: Using gutenberg-edge (14.8 rc1) new custom CSS feature doesn't work #71273

dsas opened this issue Dec 16, 2022 · 14 comments

Comments

@dsas
Copy link
Contributor

dsas commented Dec 16, 2022

Quick summary

The new Global styles custom CSS feature doesn't work

Steps to reproduce

  1. Create a new site
  2. Get a premium+ plan and use e.g. Twenty Twenty-three theme.
  3. Open the site editor
  4. Open the global styles sidebar
  5. Click the new 'Custom CSS' feature at the bottom of the page
  6. Paste some style rule in like h1.wp-block-heading { text-decoration:underline; color: orange; }
  7. Notice that the editor to the left now makes headings orange and underlined ✅
  8. Press Save and then Save again once the pre-save prompt has loaded

What you expected to happen

  • The editor to the left to remain as it is - orange underlined headings
  • To see orange, underlined headings when looking at the front-end of the site

What actually happened

  • The headings are no longer orange or underlined in the editor or on the front-end of the site
  • If I close the CSS panel and reopen it, the CSS is gone!
13x5Fk.mp4

Browser

Mozilla Firefox

Context

Testing if global styles gating works with new custom CSS feature

Platform (Simple, Atomic, or both?)

Simple

Other notes

There's an error in the browser console: Uncaught TypeError: t.target.classList is undefined

The HTTP PUT request does include the expected css string but the response doesn't.

There's nothing in my sandbox error log.

Reproducibility

Consistent

Severity

Some (< 50%)

Available workarounds?

No but the platform is still usable

Workaround details

No response

@dsas
Copy link
Contributor Author

dsas commented Dec 16, 2022

This doesn't happen in Core on the 14.8 RC tag.

@dsas
Copy link
Contributor Author

dsas commented Dec 16, 2022

Maybe it's not limited to the new custom CSS feature, it also happens when choosing a style variation for example. I choose a style variation, saved it and it half-disappeared. Many of the previews were off too

7eSC1A.mp4

@Copons
Copy link
Contributor

Copons commented Dec 16, 2022

cc @fullofcaffeine, as this might be an issue for the 14.8 Gutenberg merge if it happens before the holidays.

Wonder if this is the same (or related to) KSES issue that affects gradients (Core Trac): #71009

See also p1670602379106569-slack-CBTN58FTJ.

@dsas
Copy link
Contributor Author

dsas commented Dec 16, 2022

I'm a superadmin afaik and I was testing as my a8c-self 🤔

@dsas
Copy link
Contributor Author

dsas commented Dec 16, 2022

Global styles created via the newsletter onboarding flow do work!

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Dec 18, 2022

I just tested with a local install of 14.8-RC-1 and the global styles custom CSS saves as expected.

With Calypso the correct style value is being sent to the API but not returned, so mostly likely being stripped before saving.

The place to start debugging why this is would be here.

In order to work the WP_Theme_JSON_6_2 version of the theme json class needs to be loaded as this includes the addition of css as a VALID_STYLE here - if not the styles.css will be stripped as being invalid.

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Dec 18, 2022

This patch here needs to go into 14.8 to prevent a PHP warning being thrown if global styles are being updated but no custom CSS is included ... but it looks like this didn't get into RC1. I don't think this would affect this issue though as should just throw a warning and not affect the saving.

@mmtr
Copy link
Member

mmtr commented Dec 19, 2022

I think this is another KSES issue in Core similar to WordPress/gutenberg#45520 and https://core.trac.wordpress.org/ticket/57322.

I can reproduce the issue in Core when I enable the KSES filters with add_action( 'init', 'kses_init_filters' );

@dsas
Copy link
Contributor Author

dsas commented Dec 19, 2022

Opened up a Core issue WordPress/gutenberg#46651

@simison
Copy link
Member

simison commented Dec 20, 2022

FYI: revert of the custom CSS to an experiment

@dsas
Copy link
Contributor Author

dsas commented Jan 3, 2023

There's an open upstream PR that fixes the custom CSS issue that wfm on core. It uses the edit_css cap which we remap for the customizer custom css

@mmtr mmtr removed the Needs triage Ticket needs to be triaged label Jan 12, 2023
@mmtr
Copy link
Member

mmtr commented Jan 17, 2023

Gutenberg has re-enabled the Custom CSS feature in WordPress/gutenberg#46815 and WordPress/gutenberg#47062 after solving the issues with the KSES filters and the needed capabilities.

It'll be shipped in the next version (v15.1.0), so let's keep an eye on when it lands on WPCOM to see if it works as expected.

@mmtr
Copy link
Member

mmtr commented Feb 3, 2023

Latest update in paYJgx-2WY-p2.

@mmtr
Copy link
Member

mmtr commented Feb 13, 2023

We've confirmed that the feature remains hidden on Gutenberg v15.1.0 for Simple sites.

I also opened D101145-code to enable it in a safe way.

@mmtr mmtr closed this as completed Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants