Skip to content

Commit

Permalink
Prevent table from shifting window scroll position
Browse files Browse the repository at this point in the history
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. By setting prevent scroll to true, this wont happen
  • Loading branch information
mitchellwarr authored Feb 4, 2021
1 parent ead39d8 commit 6973784
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export default class DataSheet extends PureComponent {
// setTimeout makes sure that component is done handling the event before we take over
setTimeout(() => {
func();
this.dgDom && this.dgDom.focus();
this.dgDom && this.dgDom.focus({ preventScroll: true });
}, 1);
}
}
Expand Down Expand Up @@ -600,7 +600,7 @@ export default class DataSheet extends PureComponent {

onRevert() {
this._setState({ editing: {} });
this.dgDom && this.dgDom.focus();
this.dgDom && this.dgDom.focus({ preventScroll: true });
}

componentDidUpdate(prevProps, prevState) {
Expand Down

0 comments on commit 6973784

Please sign in to comment.