Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d925382b3 |
@@ -31,6 +31,15 @@
|
||||
let isDragging = $state(false);
|
||||
let dragStartY = 0;
|
||||
let dragStartTime = 0;
|
||||
let overlayEl = $state<HTMLDivElement | null>(null);
|
||||
|
||||
// Register ontouchmove with passive:false so e.preventDefault() works.
|
||||
// Svelte 5 does not support the |nonpassive modifier, so we use $effect.
|
||||
$effect(() => {
|
||||
if (!overlayEl) return;
|
||||
overlayEl.addEventListener('touchmove', onTouchMove, { passive: false });
|
||||
return () => overlayEl!.removeEventListener('touchmove', onTouchMove);
|
||||
});
|
||||
|
||||
function onTouchStart(e: TouchEvent) {
|
||||
// Don't hijack touches that start inside a scrollable element
|
||||
@@ -238,6 +247,7 @@
|
||||
<!-- Full-screen listening mode overlay -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={overlayEl}
|
||||
class="fixed inset-0 z-60 flex flex-col overflow-hidden"
|
||||
style="
|
||||
background: var(--color-surface);
|
||||
@@ -248,7 +258,6 @@
|
||||
touch-action: pan-x;
|
||||
"
|
||||
ontouchstart={onTouchStart}
|
||||
ontouchmove|nonpassive={onTouchMove}
|
||||
ontouchend={onTouchEnd}
|
||||
>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user