fix(front/checkbox): prevent checkbox double click event

This commit is contained in:
Alice Gaudon 2022-02-19 11:58:36 +01:00
parent 231aa8dcd7
commit 67dc33adf4

View File

@ -45,9 +45,13 @@
}
}
function focusInput() {
function focusInput(e) {
if (input) {
if (['file', 'checkbox', 'color'].indexOf(input.type) >= 0) {
if (input.type === 'checkbox') {
if (e.target !== label && e.target !== input) {
input.click();
}
} else if (['file', 'color'].indexOf(input.type) >= 0) {
input.click();
} else {
input.focus();
@ -79,6 +83,7 @@
}
let input: HTMLInputElement;
let label: HTMLLabelElement;
function chooseFile() {
input.click();
@ -440,7 +445,7 @@
<div class="sections">
{#if type !== 'duration'}
<label for={fieldId}>{@html placeholder || ''}
<label for={fieldId} bind:this={label}>{@html placeholder || ''}
<slot/>
</label>
{/if}