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]: Select does not apply error styling in dark mode #1070

Closed
jmhoffmann9612 opened this issue May 29, 2024 · 3 comments · Fixed by #1094
Closed

[Bug]: Select does not apply error styling in dark mode #1070

jmhoffmann9612 opened this issue May 29, 2024 · 3 comments · Fixed by #1094
Labels
released Type: Bug Confirmed bug, something is not working as intended

Comments

@jmhoffmann9612
Copy link

Tremor Version

3.17.2

Link to minimal reproduction

https://github.com/jmhoffmann9612/tremor-select-darkmode-error-bug

Steps to reproduce

  1. Run npm run dev / npx next dev.
  2. Open localhost:3000 in browser.
  3. Enable dark mode in system settings.

What is expected?

Select component should apply error styling (red border and text) in dark mode.

What is actually happening?

  • Select component does not have error styling in dark mode.
  • Light mode has the expected styling.

image

image

What browsers are you seeing the problem on?

Chrome, Firefox

Any additional comments?

Not super familiar with the inner workings of the library, but it seems like <Select /> elements get their error styling from getSelectButtonColors in selectUtils.ts.

hasError && "text-red-500 placeholder:text-red-500",
hasError ? "border-red-500" : "border-tremor-border dark:border-dark-tremor-border",

It seems this bug happens because the expressions for when hasError is true do not include dark: modifiers, so tailwind-merge does not overwrite any previously set dark:text-... and dark:border-... like here:

"dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",


Patching the lines in selectUtils.ts from

hasError && "text-red-500 placeholder:text-red-500",
hasError ? "border-red-500" : "border-tremor-border dark:border-dark-tremor-border",

to

hasError && "text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",
hasError ? "border-red-500 dark:border-red-500" : "border-tremor-border dark:border-dark-tremor-border",

with patch-package has worked in my project, but I so far cannot tell if this causes any unintended side effects.

@severinlandolt severinlandolt added the Type: Bug Confirmed bug, something is not working as intended label May 29, 2024
@severinlandolt
Copy link
Member

Thanks for noticing and thank for the patch suggestions 🫶

@severinlandolt
Copy link
Member

Note: Will add this to the next fix version!

Copy link

🎉 This issue has been resolved in version 3.17.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Bug Confirmed bug, something is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants