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

[v1.0] Scoped css variables #3749

Open
eldair opened this issue Mar 25, 2024 · 5 comments
Open

[v1.0] Scoped css variables #3749

eldair opened this issue Mar 25, 2024 · 5 comments

Comments

@eldair
Copy link

eldair commented Mar 25, 2024

This is about Bulma.

Overview of the problem

This is about the Bulma CSS framework

I'm using Bulma version [1.0]
I am sure this issue is not a duplicate?

Description

Just a question - why are css variables scoped when they are already unique because of prefix (for example --bulma-input-focus-border-color)? I previously built custom checkbox and used some of bulma sass variables to be consistent with other form elements but now I have to add .input or .control to my elements in order to use css variables. Is there alternative way of using those values?

@jgthms
Copy link
Owner

jgthms commented Mar 25, 2024

They are scoped because, if you apply a dark theme for example, you're setting new values like --bulma-border-l at the :root level. If you also set --bulma-input-focus-border-color at the :root level and it references --bulma-border-l, it won't be updated.

It only works if it's defined at a lower level like .input.

@eldair
Copy link
Author

eldair commented Mar 25, 2024

@jgthms I understand
Can I perhaps use those variables as sass vars if I @use bulma/form?

@darkylmnx
Copy link

They are scoped because, if you apply a dark theme for example, you're setting new values like --bulma-border-l at the :root level. If you also set --bulma-input-focus-border-color at the :root level and it references --bulma-border-l, it won't be updated.

It only works if it's defined at a lower level like .input.

could it be on a html or body level to address that issue? O do you see any specific issue with that?

@jgthms
Copy link
Owner

jgthms commented Apr 22, 2024

:root is the html level.

There could be workarounds but I'd need to look more into it.

@darkylmnx
Copy link

:root is the html level.

There could be workarounds but I'd need to look more into it.

Yeah that's why I wrote body but forgot to remove "html" haha. The local scope indeed makes it harder to edit via JS for example where it needs to target the specific element or create a style tag and append the selector necessary.

I understand the use case though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants