Skip to content

Commit

Permalink
Fix reference to TouchEvent which is not defined in Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
kiasyn authored Jan 30, 2025
1 parent 9ef7f28 commit 6093be9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/uui-base/lib/utils/drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ export const drag = (
const offsetY = dims.top + defaultView.scrollY;

let pointerEvent: PointerEvent | Touch;
if (event instanceof TouchEvent) {
// TouchEvent is not available in Firefox
if ('TouchEvent' in window && event instanceof TouchEvent) {
pointerEvent = event.touches[0];
} else {
} else if ( event instanceof PointerEvent ) {

Check failure on line 28 in packages/uui-base/lib/utils/drag.ts

View workflow job for this annotation

GitHub Actions / test (20)

Replace `·event·instanceof·PointerEvent·` with `event·instanceof·PointerEvent`
pointerEvent = event;
}

Check failure on line 30 in packages/uui-base/lib/utils/drag.ts

View workflow job for this annotation

GitHub Actions / test (20)

Delete `⏎···`
else {
return;
}

const x = pointerEvent.pageX - offsetX;
const y = pointerEvent.pageY - offsetY;
Expand Down

0 comments on commit 6093be9

Please sign in to comment.