Skip to content

[Bug]: Vitest status values can cause color contrast issues on the sidebar #31462

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

Open
JamesIves opened this issue May 12, 2025 · 2 comments · May be fixed by #31463
Open

[Bug]: Vitest status values can cause color contrast issues on the sidebar #31462

JamesIves opened this issue May 12, 2025 · 2 comments · May be fixed by #31463

Comments

@JamesIves
Copy link
Contributor

Describe the bug

When you run the Vitest addon you can end up in a situation where you have color contrast accessibility issues based on your existing theme configuration as the values are hardcoded without a way to override via a class.

Reproduction link

N/A

Reproduction steps

  1. Run the Vitest plugin.
  2. Activate an error or warning state.
  3. Depending on your theme you may end up with color contrast issues.

System

"@storybook/addon-vitest": "9.0.0-beta.11"

Additional context

Image
Copy link
Contributor

greptile-apps bot commented May 12, 2025

** Disclaimer** This information might be inaccurate, due to it being generated automatically
The Vitest status colors appear to be hardcoded in the addon-vitest package. To fix the color contrast issues: 1. Modify @storybook/addon-vitest/src/components/TestResults.tsx to use CSS variables for status colors that respect the theme: tsx // Replace hardcoded colors with CSS variables const statusStyles = { PASS: { color: 'var(--sb-test-status-pass, #66BF3C)' }, FAIL: { color: 'var(--sb-test-status-fail, #FF4400)' }, ERROR: { color: 'var(--sb-test-status-error, #E64980)' }, RUNNING: { color: 'var(--sb-test-status-running, #66BF3C)' }, TODO: { color: 'var(--sb-test-status-todo, #737373)' }, }; 2. Add these variables to the theme in @storybook/addon-vitest/src/preset/manager.ts: ts addons.setConfig({ theme: { vars: { 'sb-test-status-pass': '#66BF3C', 'sb-test-status-fail': '#FF4400', 'sb-test-status-error': '#E64980', 'sb-test-status-running': '#66BF3C', 'sb-test-status-todo': '#737373' } } });

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

@JamesIves
Copy link
Contributor Author

Possible solution in #31463 - needs discussion.

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

Successfully merging a pull request may close this issue.

3 participants