I've encountered an unusual issue 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/
These are custom checkboxes where the normal checkbox is hidden as part of a debugging process. When I click on the label or box, it functions correctly with green indicating checked and red indicating unchecked. However, there is an issue when I quickly click on the label (text) and then space to the left sometimes results in the "active" class not being assigned correctly.
An animation demonstrating the problem can be viewed here:
I have attempted to log every click event to verify if double clicks are being registered, but this does not seem to be the cause.
Thank you in advance.