Skip to content

Commit

Permalink
Fix column resizing in FF (adazzle#3373)
Browse files Browse the repository at this point in the history
* Fix column resizing in FF

* Fix scrolling in FF

* `preventDefault` is no longer needed

* Remove `isResizing` state

* Updated comment
  • Loading branch information
amanmahajan7 authored Oct 20, 2023
1 parent ae2d77f commit 107a3ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/HeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ export default function HeaderCell<R, SR>({
return;
}

// Fix column resizing on a draggable column in FF
event.preventDefault();

const { currentTarget, pointerId } = event;
const headerCell = currentTarget.parentElement!;
const { right, left } = headerCell.getBoundingClientRect();
const offset = isRtl ? event.clientX - left : right - event.clientX;

function onPointerMove(event: PointerEvent) {
// prevents text selection in Chrome, which fixes scrolling the grid while dragging, and fixes re-size on an autosized column
event.preventDefault();
const { right, left } = headerCell.getBoundingClientRect();
const width = isRtl ? right + offset - event.clientX : event.clientX + offset - left;
if (width > 0) {
Expand Down

0 comments on commit 107a3ae

Please sign in to comment.