I've got weird problem with my checkboxes.
HTML:
<div class="f-checkbox">
<label class="f-label" for="f-field">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure cumque
voluptatem nisi incidunt praesentium quibusdam sit in alias velit
consectetur facere amet voluptates possimus, aliquid nam omnis fugit eum
molestias ucimus, saepe laboriosam, enim nobis. Omnis eveniet rem
impedit,commodi mollitia assumenda beatae nulla consequuntur autem debitis
fugiat voluptatem laudantium!
</label>
<input type="checkbox" id="f-field" name="f-field" value="1" aria-invalid="false">
</div>
JS:
jQuery('.f-checkbox label').on('click', function(e){
jQuery(this).parent('.f-checkbox').toggleClass('active');
console.log('Test');
})
Fiddle link: https://jsfiddle.net/orddstgo/2/
It's just "custom" checkbox (pretend that normal checkbox is hidden, it's just for debugging process). When I click label/box it works correctly. Green is checked, red is unchecked. Problem is when I click label (text) and then space on the left fast enough. Sometimes it flips and "active" class is not assigned correctly.
Here's animation that shows the problem: https://gfycat.com/BraveExcitableAdamsstaghornedbeetle
I've tried logging every click to check if there's no double clicks registering but no.
Thanks in advance.