samedi 29 juillet 2017

Clicking image inside of a doesn't reliably change checkbox when text is selected in Chromium browsers

I have a checkbox, and then I have a <label> with a for attribute which is used to activate this checkbox. There is an <img> within this label. Usually, clicking the image changes the checkbox, but when text is selected elsewhere in the page it doesn't always work on the first click. Example:

Select this text! Then try to activate the checkbox by clicking the image while text is still selected: 
<input id='check' type='checkbox'>
<label for='check'>
    <img style='height: 75px' src='http://ift.tt/2w9uaVX'>
</label>

It works as expected in Firefox (only takes one click, and is reliable), so I'm inclined to believe this is a browser issue, but am not 100% sure. Is there anything else that could be causing this, and any possible way to work around it?




Aucun commentaire:

Enregistrer un commentaire