Skip to content

Commit

Permalink
Add native element payload handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
DTCurrie committed Aug 29, 2023
1 parent ae30984 commit ab067cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/lib/select/select.svelte
Expand Up @@ -47,7 +47,7 @@ export let state: SelectState = 'none';
const onInput = (event: Event) => {
if (disabled) {
event.preventDefault();
event.stopImmediatePropagation();
return;
}
Expand All @@ -56,7 +56,7 @@ const onInput = (event: Event) => {
const onMouseDown = (event: MouseEvent) => {
if (disabled) {
event.preventDefault();
event.stopImmediatePropagation();
return;
}
Expand All @@ -65,7 +65,7 @@ const onMouseDown = (event: MouseEvent) => {
const onKeyDown = (event: KeyboardEvent) => {
if (disabled && event.key.toLowerCase() !== 'tab') {
event.preventDefault();
event.stopImmediatePropagation();
return;
}
Expand Down Expand Up @@ -96,8 +96,11 @@ $: isError = state === 'error';
)}
{...$$restProps}
on:input={onInput}
on:input
on:mousedown={onMouseDown}
on:mousedown
on:keydown={onKeyDown}
on:keydown
>
<slot />
</select>
Expand Down

0 comments on commit ab067cc

Please sign in to comment.