From 6e9396440ec4da4f188f08b14ec7edf1dcde2fde Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Sat, 19 Apr 2025 21:05:26 +0200 Subject: [PATCH 1/3] Fix selection on click in color area --- packages/uui-base/lib/utils/drag.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/uui-base/lib/utils/drag.ts b/packages/uui-base/lib/utils/drag.ts index 4a67cf0b4..002f5dbb8 100644 --- a/packages/uui-base/lib/utils/drag.ts +++ b/packages/uui-base/lib/utils/drag.ts @@ -25,7 +25,9 @@ export const drag = ( // TouchEvent is not available in Firefox if ('TouchEvent' in window && event instanceof TouchEvent) { pointerEvent = event.touches[0]; - } else if (event instanceof PointerEvent) { + } else if (event instanceof MouseEvent) { + // Some browsers seems to return PointerEvent instead of MouseEvent for click event. + // We can use MouseEvent as PointerEvent inherits from MouseEvent. pointerEvent = event; } else { return; From 3461f1aa9ea673b20f4e59f4bd7cd1d17cae4732 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Sat, 19 Apr 2025 21:24:14 +0200 Subject: [PATCH 2/3] Update packages/uui-base/lib/utils/drag.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/uui-base/lib/utils/drag.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uui-base/lib/utils/drag.ts b/packages/uui-base/lib/utils/drag.ts index 002f5dbb8..8feacb4ff 100644 --- a/packages/uui-base/lib/utils/drag.ts +++ b/packages/uui-base/lib/utils/drag.ts @@ -26,7 +26,7 @@ export const drag = ( if ('TouchEvent' in window && event instanceof TouchEvent) { pointerEvent = event.touches[0]; } else if (event instanceof MouseEvent) { - // Some browsers seems to return PointerEvent instead of MouseEvent for click event. + // Some browsers seem to return PointerEvent instead of MouseEvent for click event. // We can use MouseEvent as PointerEvent inherits from MouseEvent. pointerEvent = event; } else { From fa12a498e6ad0be99854d0abf821c02f42ad9235 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Sun, 20 Apr 2025 19:55:50 +0200 Subject: [PATCH 3/3] Add comment --- packages/uui-base/lib/utils/drag.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/uui-base/lib/utils/drag.ts b/packages/uui-base/lib/utils/drag.ts index 8feacb4ff..81f43c087 100644 --- a/packages/uui-base/lib/utils/drag.ts +++ b/packages/uui-base/lib/utils/drag.ts @@ -28,6 +28,8 @@ export const drag = ( } else if (event instanceof MouseEvent) { // Some browsers seem to return PointerEvent instead of MouseEvent for click event. // We can use MouseEvent as PointerEvent inherits from MouseEvent. + // Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1675847 + // Safari: https://bugs.webkit.org/show_bug.cgi?id=218665 pointerEvent = event; } else { return;