nadbm / react-datasheet

Excel-like data grid (table) component for React
https://nadbm.github.io/react-datasheet/
MIT License
5.4k stars 455 forks source link

Prevent table from shifting window scroll position #264

Closed mitchellwarr closed 3 years ago

mitchellwarr commented 3 years ago

Problem

Issue: #147

When focusing on the table for keyboard usage, the focus event steals the windows scroll position, this is only a problem if the table is larger than the screen it is on.

Solution

By setting prevent scroll to true, this wont happen.

Considerations

There is varying browser implementation for this, but otherwise it is very stable. The main thing to consider is that browsers that don't implement this functionality yet, wont break or throw any errors. They just ignore the boolean flag