diff --git a/src/global.d.ts b/src/global.d.ts index fcdb1bc..62b7d6d 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -6,6 +6,7 @@ // Swipe declare namespace svelte.JSX { interface HTMLAttributes { - onswipe?: (event: CustomEvent & { target: EventTarget & T }) => any + onswipe?: (event: CustomEvent & { target: EventTarget & T }) => any, + ontap?: (event: CustomEvent & { target: EventTarget & T }) => any, } } \ No newline at end of file diff --git a/src/utils/interactions/swipe.ts b/src/utils/interactions/swipe.ts index c4bc5ba..a967789 100644 --- a/src/utils/interactions/swipe.ts +++ b/src/utils/interactions/swipe.ts @@ -64,6 +64,11 @@ export const swipe = ( node.dispatchEvent( new CustomEvent('swipe', { detail: direction }) ) + } else { + // Dispatch tap event + node.dispatchEvent( + new CustomEvent('tap', { detail: true }) + ) } } node.addEventListener('pointerup', onUp, false)