mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Prevent deck options switches from toggling on label click (#2166)
* Prevent deck options switches from toggling on label click because the label click is reserved to open the help modal. * Add option to prevent mouseclick event to Label.svelte
This commit is contained in:
parent
dba4925aba
commit
fd2212a6cb
2 changed files with 11 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
let forId: string;
|
let forId: string;
|
||||||
export { forId as for };
|
export { forId as for };
|
||||||
|
export let preventMouseClick = false;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
@ -17,7 +18,15 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label bind:this={spanRef} for={forId}><slot /></label>
|
<label
|
||||||
|
bind:this={spanRef}
|
||||||
|
for={forId}
|
||||||
|
on:click={(e) => {
|
||||||
|
if (preventMouseClick) e.preventDefault();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</label>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
label {
|
label {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row --cols={6}>
|
<Row --cols={6}>
|
||||||
<Col --col-size={4}><Label for={id}><slot /></Label></Col>
|
<Col --col-size={4}><Label for={id} preventMouseClick><slot /></Label></Col>
|
||||||
<Col --col-justify="flex-end">
|
<Col --col-justify="flex-end">
|
||||||
<ConfigInput grow={false}>
|
<ConfigInput grow={false}>
|
||||||
<Switch {id} bind:value />
|
<Switch {id} bind:value />
|
||||||
|
|
Loading…
Reference in a new issue