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: Rating unchecked displays all as checked #3308

Open
pkpg opened this issue Dec 10, 2024 · 3 comments
Open

bug: Rating unchecked displays all as checked #3308

pkpg opened this issue Dec 10, 2024 · 3 comments
Assignees
Labels

Comments

@pkpg
Copy link

pkpg commented Dec 10, 2024

What version of daisyUI are you using?

v4.12.20

Which browsers are you seeing the problem on?

All browsers

Reproduction URL

https://play.tailwindcss.com/KFg2Be57Wl

Describe your issue

If none of the stars is checked, all stars display as checked.

Copy link

Thank you @pkpg for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

@saadeghi saadeghi self-assigned this Dec 11, 2024
@cluk3
Copy link

cluk3 commented Dec 14, 2024

Hey @saadeghi looks like the problem is the following css in src/components/styled/rating.css:

 input:checked ~ input,
  input[aria-checked="true"] ~ input {
    @apply bg-opacity-20;
  }

so when there isn't any input checked the bg-opacity-20 will not apply. I propose to invert the logic to have bg-opacity-20 as default and then apply full opacity to the checked input and the one before:

input:checked, input:has(~ input:checked) {
  @apply bg-opacity-100;
}

I can open a PR myself if you wish!

@saadeghi
Copy link
Owner

@cluk3 that's right. I already fixed that in v5 alpha.

&:has(~ *:checked, ~ *[aria-checked="true"]) {

I will also do a patch tomorrow to fix this in v4.

@saadeghi saadeghi added the v5 label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants