schrodinger / fixed-data-table-2

A React table component designed to allow presenting millions of rows of data.
http://schrodinger.github.io/fixed-data-table-2/
Other
1.29k stars 289 forks source link

Fix scrollbar errors when offset is zero #724

Closed pradeepnschrodinger closed 4 months ago

pradeepnschrodinger commented 4 months ago

Description

This fixes the issue seen at #723. The onmousedown handler for Scrollbar throws an error when the user tries to scroll at the beginning of the scroll content area, which happens because targetTouches is undefined at: https://github.com/schrodinger/fixed-data-table-2/blob/522e82be907c41c250b231a76e3127abed9aed81/src/plugins/Scrollbar.js#L527-L537 because we're actually doing a normal mouse click instead of a "touch" click. But the code shouldn't have reached here in the first place.

The root problem is that FDT thinks it's a touch event because of the way we use the || operator in https://github.com/schrodinger/fixed-data-table-2/blob/522e82be907c41c250b231a76e3127abed9aed81/src/plugins/Scrollbar.js#L358-L364 We should instead use the ?? operator for cases like this.

Motivation and Context

Fixes #723

How Has This Been Tested?

Tested on local examples

Types of changes

Checklist:

pradeepnschrodinger commented 4 months ago

@karry08 , friendly ping

karry08 commented 4 months ago

lgtm

pradeepnschrodinger commented 4 months ago

Released with v2.0.12.