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]: Invalid CSS variable name in chart component #6172

Open
2 tasks done
ianmuscat opened this issue Dec 24, 2024 · 0 comments
Open
2 tasks done

[bug]: Invalid CSS variable name in chart component #6172

ianmuscat opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ianmuscat
Copy link

Describe the bug

The chart component appears to set a CSS variable dynamically as --color-${key}. However, the value of key is allowed to contain characters that are invalid as part of a CSS variable name. For example, the . character is not valid in CSS identifiers as per the CSS specification.

Actual result
image

Expected result
image

Affected component/components

Chart

How to reproduce

(see linked StackBlitz example, based off-of this)

  1. Use the chart component with data/chart config which contains a key that would be an invalid in a CSS variable (e.g. example.com). As a workaround, you can use a legal CSS variable name as the key, and customize the name using the label (however it was not immediately obvious where the issue lay).

Codesandbox/StackBlitz link

https://stackblitz.com/edit/shadcn-chart-cssvar-issue

Logs

No response

System Info

Chrome, macOS

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@ianmuscat ianmuscat added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant