Skip to content

Commit 517788b

Browse files
bjarnefCopilot
andauthored
fix: selection on click in color area (#1075)
* Fix selection on click in color area * Update packages/uui-base/lib/utils/drag.ts Co-authored-by: Copilot <[email protected]> * Add comment --------- Co-authored-by: Copilot <[email protected]>
1 parent 7ebb03c commit 517788b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/uui-base/lib/utils/drag.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export const drag = (
2525
// TouchEvent is not available in Firefox
2626
if ('TouchEvent' in window && event instanceof TouchEvent) {
2727
pointerEvent = event.touches[0];
28-
} else if (event instanceof PointerEvent) {
28+
} else if (event instanceof MouseEvent) {
29+
// Some browsers seem to return PointerEvent instead of MouseEvent for click event.
30+
// We can use MouseEvent as PointerEvent inherits from MouseEvent.
31+
// Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1675847
32+
// Safari: https://bugs.webkit.org/show_bug.cgi?id=218665
2933
pointerEvent = event;
3034
} else {
3135
return;

0 commit comments

Comments
 (0)