Skip to content

Commit

Permalink
Fix checkbox action
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Sep 3, 2024
1 parent 175ef71 commit 7ffb176
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selenite/commons",
"version": "0.22.12",
"version": "0.22.13",
"repository": "github:ShaitanLyss/selenite-commons",
"license": "MIT",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions src/lib/actions/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export const checkbox: Action<HTMLInputElement, boolean | undefined> = (node, en
if (pointedDownCheckbox) {
document.body.style.userSelect = 'none';
}
});
}, {capture: true});
document.addEventListener('pointerup', () => {
document.body.style.userSelect = '';
pointedDownCheckbox = undefined;
});
}, {capture: true});
}

function triggerOnEnter(event: KeyboardEvent) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/checkbox/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { checkbox, keyboardNavigation } from '$lib';
import { checkbox, keyboardNavigation, stopPropagation } from '$lib';
import { range } from 'lodash-es';
</script>

Expand All @@ -11,7 +11,7 @@
{#each range(10) as i}
<label class="flex gap-2 items-center">
{i}
<input type="checkbox" class="checkbox" use:checkbox use:keyboardNavigation />
<input type="checkbox" class="checkbox" use:checkbox use:keyboardNavigation onpointerdown={stopPropagation} onpointerup={stopPropagation}/>
</label>
{/each}
</ul>
Expand Down

0 comments on commit 7ffb176

Please sign in to comment.