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

Custom CSS: Additional CSS is lost after browsing different style variations regardless of whether it's saved #47433

Open
hagege opened this issue Jan 25, 2023 · 12 comments
Labels
[Feature] History History, undo, redo, revisions, autosave. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@hagege
Copy link

hagege commented Jan 25, 2023

Description

Any unsaved CSS rules are completely lost under Additional CSS if I have selected another variation via the Browse styles option and then switch back to the previous layout, which already contained additional CSS.

Step-by-step reproduction instructions

  1. Browse styles (for example pilgrim with addtional CSS)
  2. Choose a variation to change the look of the site (for example Default without addtional CSS)
  3. Back to Layout Pilgrim (nothing saved yet)
  4. Additional CSS is empty - no css rules

It would be good to as a minimum at least prompt users that their unsaved custom CSS changes will be lost if they switch variations and give the option to save before switching.

Screenshots, screen recording, code snippet

https://haurand.com/wp-content/uploads/2023/01/issue_additional_css.gif

Environment info

WordPress 6.1.1 and Gutenberg 15.0.1

Please confirm that you have searched ex

issue_additional_css
isting issues in the repo.

Yes

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

Yes

@glendaviesnz glendaviesnz added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Jan 25, 2023
@glendaviesnz
Copy link
Contributor

This actually applies to all global style settings, eg. in the default style variation for 2023 theme if you set custom colors for the heading block under global styles, and then switch to a different style variation, the custom heading colors are not copied across.

I think the intention is that you can apply your own customisations to each of the style variations independent of the others, and Additional CSS is just another global style attribute so behaves in the same way.

I wasn't involved at all in the setup of the style variations though, so not sure about the background as to why it is structured this way.

@hagege
Copy link
Author

hagege commented Jan 26, 2023

thanks for info

@carolinan
Copy link
Contributor

But should they be lost when you switch back? I mean that is different from not being copied over to the second variation.

@hagege
Copy link
Author

hagege commented Jan 26, 2023

I definitely did not save any settings in between, I just changed the browse style. In my opinion this should only happen (logically) if I save the state (Custom).
Possibly I create another video today for clarification, if that should help.

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Jan 26, 2023

But should they be lost when you switch back? I mean that is different from not being copied over to the second variation.

The issue will be with (nothing saved yet) - if nothing else it should probably warn you that your unsaved changes are going to be lost if you switch variations and give you the option to save them.

I will update the description to be a bit more explicit about this - @hagege feel free to edit again if I have missed your intent with the changes I make.

@glendaviesnz glendaviesnz changed the title Additional CSS is lost after changing Browse Styles Custom CSS: Unsaved Additional CSS is lost after browsing different style variations Jan 26, 2023
@hagege
Copy link
Author

hagege commented Jan 26, 2023

Here's a new video that might make this nevertheless very strange thing clearer:
issue_additional_css_2

@annezazu annezazu added the [Feature] History History, undo, redo, revisions, autosave. label Jan 26, 2023
@annezazu annezazu changed the title Custom CSS: Unsaved Additional CSS is lost after browsing different style variations Custom CSS: Additional CSS is lost after browsing different style variations regardless of whether it's saved May 18, 2023
@annezazu
Copy link
Contributor

Noting that this happens regardless of save status. I've updated the title of the issue to better reflect both.

@hagege
Copy link
Author

hagege commented May 18, 2023

Here is another video that may further clarify the issue:
issue_change_style_lost_custom_css_2

@richtabor
Copy link
Member

Yea browsing different variations shouldn't remove custom CSS; seems a bug.

Perhaps saving a variation shouldn't remove the CSS as well. Maybe it should be toggled off, but not necessarily deleted.

@hagege
Copy link
Author

hagege commented Apr 22, 2024

Sorry to ask again, but is there any news on this?

@annezazu
Copy link
Contributor

No further update! There's this PR that was stalled due to broader concerns around how user global style changes are saved. I agree with the thought on that PR thread and will leave a comment as much:

I think we could take a similar approach here so instead of a checkbox we just prompt if we detect CSS changes "Do you want to bring your CSS changes over to the new variation?"

@hagege
Copy link
Author

hagege commented Apr 22, 2024

Great idea - thanks for answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] History History, undo, redo, revisions, autosave. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants