Skip to content

Commit

Permalink
Disable pointer events when scrollbar drag
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzmf committed Jun 7, 2024
1 parent 0cf968d commit c179fca
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const Scrollbar = forwardRef<HTMLDivElement, ScrollbarProps>((props, forw
rectRef.current = scrollbar!.getBoundingClientRect();
prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
document.body.style.webkitUserSelect = 'none';
document.body.style.pointerEvents = 'none';
handleDragScroll(event);
}
})}
Expand All @@ -106,6 +107,7 @@ export const Scrollbar = forwardRef<HTMLDivElement, ScrollbarProps>((props, forw
element.releasePointerCapture(event.pointerId);
}
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
document.body.style.pointerEvents = 'auto';
rectRef.current = null;
})}
/>
Expand Down

0 comments on commit c179fca

Please sign in to comment.