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: always disabled button when disabled attribute is present #3011

Closed
nandi95 opened this issue May 2, 2024 · 2 comments
Closed

bug: always disabled button when disabled attribute is present #3011

nandi95 opened this issue May 2, 2024 · 2 comments

Comments

@nandi95
Copy link
Contributor

nandi95 commented May 2, 2024

What version of daisyUI are you using?

v4.10.3

Which browsers are you seeing the problem on?

No response

Reproduction URL

https://play.tailwindcss.com/U7A0haQXUu

Describe your issue

https://github.com/saadeghi/daisyui/blob/master/src/components/styled/button.css#L326

In vue js and probably other frameworks I can do :disabled="myVar" this means sometimes it's disabled="true" sometimes it's disabled="false". (vue removes the disabled attribute from the if it's binded on the button but my usecase is an anchor tag in which case vue doesn't remove the attribute only sets it to false). However daisy only check if the attribute is present, see above link to code.

My workaround is I apply the disabled classes when it should be disabled: :class="{ 'btn-disabled pointer-events-none': pending }"

Copy link

github-actions bot commented May 2, 2024

Thank you @nandi95 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
Copy link
Owner

saadeghi commented May 2, 2024

disabled is not a valid attribute for <a>. So what you're trying to do, is not valid HTML.
Ideally you should conditionally render a <a> tag only if it should be a link.

Also, in Vue, to conditionally add the disabled attribute, you can use :disabled="null" (not :disabled="false")

@saadeghi saadeghi closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants