-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: checkbox theme controller broken if data-theme equals input value #3251
Comments
Thank you @Fak3
for reporting issues. It helps daisyUI a lot 💚
|
Thanks for the reproduction link.
It is working as expected. Let me know if you have a question. |
This surprising behavior should be documented. When the data-theme and checkbox value match, then the checkbox does nothing. Docs should guide users to use radio button instead. |
https://daisyui.com/components/theme-controller/ Maybe I can rephrase that to be more clear. |
Even funnier is that if both radio and checkbox controller exist on the same page, then both work properly. |
Oh, it is not correct - if the checkbox is not checked, then radio controller work fine. If the checkbox is checked then the radio stops responding. But if the radio is set to 'retro', then checkbox does not work. |
Here's how it works: :root:has(input.theme-controller[value=retro]:checked) {
} it means if page has a There's no magic, or JS script to check what was the previous theme. You only need one Let me know if you have a question. |
Honestly I don't see a situation that multiple theme selectors in one page would be needed, otherwise I would mention that in the docs. |
This should expand on the handling of |
I will update the docs. Thanks |
What version of daisyUI are you using?
v4.12.13
Which browsers are you seeing the problem on?
All browsers
Reproduction URL
https://fak3.github.io/daisy-test/checkbox.html
Describe your issue
If data-theme value of <html> is the same as theme-controller checkbox, then it does not work. Example: https://fak3.github.io/daisy-test/checkbox.html
HTML snippet:
Expected behavior: unchecking checkbox should reset theme to default.
Observed behavior: checkbox does not do anything at all.
In contrast, radio theme switch works as expected: https://fak3.github.io/daisy-test/radio.html
The text was updated successfully, but these errors were encountered: