From 4316893d5b8f78a45aeb3cad52bc1b4eb8a6a9a4 Mon Sep 17 00:00:00 2001 From: Mohsen Karami Date: Mon, 20 Oct 2025 15:01:55 +0330 Subject: [PATCH] fix: Handle undefined changedTouches for non-touch devices --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 177c8ba..03f8347 100644 --- a/src/index.ts +++ b/src/index.ts @@ -322,8 +322,9 @@ const Vue3TouchEvents: Plugin> = { function checkZoom($this, event) { - // get the list of changed touches from the event - const touches = event.changedTouches; + // get the list of changed touches from the event (default to empty array for non-touch devices) + // without the fallback, `event.changedTouches` is undefined on desktop, causing error when checking length. + const touches = event.changedTouches || []; // check if exactly two fingers are being used if (touches.length !== 2) {