flowbite icon indicating copy to clipboard operation
flowbite copied to clipboard

Toggle: label for and input id

Open jjagielka opened this issue 2 years ago • 1 comments

Describe the bug

From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Label

To associate the

	<label>Do you like peas?
	<input type="checkbox" name="peas">
	</label>

Toggle example is implemented with the latter option i.e. input embedded in label, so for and id are redundant.

<label for="default-toggle" class="inline-flex relative items-center cursor-pointer">
  <input type="checkbox" value="" id="default-toggle" class="sr-only peer">
  <div class="w-11 h-6 ..."></div>
  <span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">Toggle me</span>
</label>

jjagielka avatar Jul 16 '22 22:07 jjagielka

Thanks for noticing.

I'm using the toggle inside a dropdown menu. Due to this for attribute, the popup was getting closed.

alekstrust avatar Aug 02 '22 16:08 alekstrust

Hey @jjagielka @alekstrust,

Thanks for reporting - will be addressed with the v1.5.4 update.

zoltanszogyenyi avatar Oct 31 '22 15:10 zoltanszogyenyi

Fixed in v1.5.4 update with this commit https://github.com/themesberg/flowbite/commit/88237cf66bd1e6ce0267a23f82cba1fc908f11b6.

zoltanszogyenyi avatar Nov 15 '22 11:11 zoltanszogyenyi