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

Modern Theme Colors (CSS Variables) are applied to the root body component of the entire page, not scoped to the SurveyJS container #5717

Closed
JosephBrooksbank opened this issue Feb 28, 2023 · 3 comments
Assignees
Milestone

Comments

@JosephBrooksbank
Copy link

JosephBrooksbank commented Feb 28, 2023

Are you requesting a feature, reporting a bug or asking a question?

reporting a bug/requesting a feature

What is the current behavior?

StyleManager updates style attribute on the main body of the entire page. This is very intrusive, and can have unintended consequences on other libraries that use the same css variable names.

What is the expected behavior?

Styles would be applied through the sv-root (or similar) div rather than the body of the whole page

How would you reproduce the current behavior (if this is a bug)?

https://codesandbox.io/s/surveyjs-intrusive-styling-lsq8q8 you can see a demo of this issue here. The text at the top of the app (outside of the surveyJS container) is being styled by surveyJS unintentionally.

If you really must apply them to the body of the page, I would ask that you use unique variable names then, rather than generics like text-color and error-color

Specify your

  • browser: N\A
  • browser version: N\A
  • surveyjs platform (angular or react or jquery or knockout or vue): react
  • surveyjs version: 1.9.75
@JaneSjs JaneSjs self-assigned this Feb 28, 2023
@JaneSjs
Copy link
Contributor

JaneSjs commented Feb 28, 2023

Hello @JosephBrooksbank,
Thank you for reporting this issue. We will research it and let you know our results.
For the record: the issue is reproduced with the Modern theme. With defaultV2, the custom text uses the specified (green) color (example).

@JaneSjs JaneSjs added the bug label Feb 28, 2023
@JaneSjs JaneSjs changed the title CSS Variables from StyleManager are applied to the root body component of the entire page, not scoped to the surveyJS container Modern Theme Colors (CSS Variables) are applied to the root body component of the entire page, not scoped to the SurveyJS container Feb 28, 2023
@JaneSjs JaneSjs removed their assignment Feb 28, 2023
@OlgaLarina OlgaLarina added this to the v1.9.77 milestone Feb 28, 2023
@tsv2013
Copy link
Member

tsv2013 commented Mar 2, 2023

We apply variables to the body because they should be applied to popups which are added to the body. Unfortunately right now, we'd prefer don't rename CSS variables because it would be a breaking change for our users. Most likely we'll rename our variables after we'll implement theme editor and release a major update (v2.x.x) with these breaking changes.

I leave this issue open in our backlog and we'll return to it later.

@OlgaLarina OlgaLarina removed this from the v1.9.77 milestone Mar 2, 2023
@tsv2013
Copy link
Member

tsv2013 commented Jul 5, 2023

Right now we're working active on the Theme Builder feature of the Survey Creator V2. You can check the progress in the following issues:
surveyjs/survey-creator#2905
surveyjs/survey-creator#4259
#6252
and some others.

This feature will assist user to modify survey look and feel according his needs. 10 new themes will be introduced. End-users will be able to customize colors, paddings, font styles, panels transparency and other settings. Working on this feature we've solved this issue - moved CSS variables from body to survey root element.

In the nearest future (somewhere in a half-year) we're going to release version 2 of our products. In this major update we're going to deprecate all legacy themes: default (and modifications) and modern.

We invite you to test our new feature. Your feedback.is highly appreciated.

@tsv2013 tsv2013 closed this as completed Jul 5, 2023
@OlgaLarina OlgaLarina added this to the v1.9.97 milestone Jul 10, 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

4 participants