Skip to content

Commit

Permalink
fix: do not select text when selecting (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxianxi authored Jun 7, 2024
1 parent b9814c4 commit 427636f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Selectable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ function Selectable<T>(
}

const onMouseMove = (e: MouseEvent | TouchEvent) => {
// prevent default scroll behavior when mouse move
e.preventDefault();
if (isMouseDowning) {
const { clientX, clientY } = getClientXY(e);
moveClient.current = { x: clientX, y: clientY };
Expand Down Expand Up @@ -250,6 +248,8 @@ function Selectable<T>(
};

const onMouseDown = (e: MouseEvent | TouchEvent) => {
// disable text selection, but it will prevent default scroll behavior when mouse move, so we used `useScroll`
e.preventDefault();
isMouseDowning = true;

if (selectStartRangeRef.current !== 'all') {
Expand Down

0 comments on commit 427636f

Please sign in to comment.