Skip to content

bug: validator: green border on firefox when button is within input label #3938

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

Closed
condemil opened this issue Jun 3, 2025 · 3 comments
Closed

Comments

@condemil
Copy link

condemil commented Jun 3, 2025

Reproduction URL (Required)

https://play.tailwindcss.com/0g01zOPpVo

What version of daisyUI are you using?

latest

Which browsers are you seeing the problem on?

This issue happens only on Firefox, but not on WebKit-based browsers.
I checked with Firefox Developer Edition 140.0b4 (aarch64).

Describe your issue

Reproducible in playground with the following code:

<label class="input validator">
  <input name="test" type="text">
  <button></button>
</label>
Copy link

github-actions bot commented Jun 3, 2025

Thank you @condemil 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.

@condemil condemil changed the title bug: validator: green border on firefox when button is inside bug: validator: green border on firefox when button is inside input label Jun 3, 2025
@condemil condemil changed the title bug: validator: green border on firefox when button is inside input label bug: validator: green border on firefox when button is within input label Jun 3, 2025
@pdanpdan
Copy link

pdanpdan commented Jun 5, 2025

That is not really a valid html construct.
You have 2 form elements that the label can consider as target, and I suppose chrome/safari chooses the first one and Firefox the second one.
If you add a for="name" on the label it should solve the problem.

@saadeghi
Copy link
Owner

saadeghi commented Jun 5, 2025

@condemil @pdanpdan is right. There must be one input in a <lable> tag. You can use a div if you want more inputs:

<div class="input validator">
  <input name="test" type="text">
  <button>button</button>
</div>

Also, since there's no text label for the <input>, consider adding a aria-label="my input" to <input> tag to make sure it's accessible for screen readers.

@saadeghi saadeghi closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2025
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

3 participants