-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
The style method not work when using css variables #1293
Comments
Thanks, @CrystalWindSnake! Minimal reproduction: ui.add_body_html('<div id="element">Test</div>')
ui.query('#element').style('--color: red; color: var(--color);') In contrast, this works: ui.label('Test').style('--color: red; color: var(--color);') It looks like this line in query.js document.querySelectorAll(this.selector).forEach((e) => (e.style[key] = val)) should be replaced with document.querySelectorAll(this.selector).forEach((e) => e.style.setProperty(key, val)) Needs some more investigation and testing. |
ChatGPT's explanation why we need to use
|
👍 |
Description
The
--left
and--top
variable set by the style method in the above code do not work on the corresponding label.The text was updated successfully, but these errors were encountered: