Bug with clicking on checkbox div
does not toggle it
#1515
-
The test case is here -> https://jsfiddle.net/f2b6u8pk/ To trigger the bug just click on "Pessoa Jurídica" and for some strange reason, the checkbox does not "checks" itself. At the documentation page https://fomantic-ui.com/modules/checkbox.html when I click on the text at the side of the checkbox, makes it toggle the state of the checkbox. Fixing trhis bug would improve a lot usability mainly on mobile devices where the checkbox itself gets too much small and it helps having the text clickable. Maybe the bug relies in the fact that the checkbox is inside a modal? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@batata004 , You're using simple CSS checkbox, which doesn't toggle by clicking the label or the container
Here's the fiddle https://jsfiddle.net/g6apz07o/. Here's the documentation without Javascript (https://fomantic-ui.com/modules/checkbox.html#/usage) which have the same as yours. |
Beta Was this translation helpful? Give feedback.
-
It's also possible without using javascript.
<div class="ui checkbox">
<input id="cb1" type="radio" value="Pessoa Física" name="pessoa" checked="checked" class="hidden" />
<label for="cb1">Pessoa Física</label>
</div>
<div class="ui checkbox">
<input id="cb2" type="radio" value="Pessoa a Jurídica" name="pessoa" checked="checked" class="hidden" />
<label for="cb2">Pessoa a Jurídica</label>
</div> |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
It's also possible without using javascript.
for
attribute for the label pointing to the id of the input elementhidden
to the input field (this adds the pointer cursor, clicking on the label will also work without that)See https://jsfiddle.net/lubber/ysvgz0rt/1/