Skip to content

Commit

Permalink
Calling scrollToRow for List/Table no longer potentially interferes w…
Browse files Browse the repository at this point in the history
…ith scrollLeft offset
  • Loading branch information
Brian Vaughn committed Mar 4, 2017
1 parent eab6b24 commit 7ad9b3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
* 🎉 New `Table` prop, `headerRowRenderer`. ([@kaoDev](https://github.com/kaoDev) - [#600](https://github.com/bvaughn/react-virtualized/pull/600))
* 🎉 All `Table` event handlers now receive a named `event` params ([@paulbrom](https://github.com/paulbrom) - [#605](https://github.com/bvaughn/react-virtualized/pull/605))
* 🎉 Aria roles for `Table` improved to specify `role="row"` for table rows and `role="rowgroup"` for iner `Grid`. ([@jchen527](https://github.com/jchen527) - [#607](https://github.com/bvaughn/react-virtualized/pull/607))
* 🐛 Calling `scrollToRow` for `List` or `Table` no longer potentially messes up horizontal scroll position. ([#603](https://github.com/bvaughn/react-virtualized/issues/603))

##### 9.1.0
* 🎉 Public method `setScrollIndexes` added to `ArrowKeyStepper` to enable easier overrides of current/default focused cell. - ([@alexandro81](https://github.com/alexandro81) - [#592](https://github.com/bvaughn/react-virtualized/pull/592))
Expand Down
16 changes: 12 additions & 4 deletions source/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,19 @@ export default class Grid extends PureComponent {
columnIndex,
rowIndex
}) {
const { columnCount } = this.props

const props = this.props
this._updateScrollLeftForScrollToColumn({
...props,
scrollToColumn: columnIndex
})

// Don't adjust scroll offset for single-column grids (eg List, Table).
// This can cause a funky scroll offset because of the vertical scrollbar width.
if (columnCount > 1) {
this._updateScrollLeftForScrollToColumn({
...props,
scrollToColumn: columnIndex
})
}

this._updateScrollTopForScrollToRow({
...props,
scrollToRow: rowIndex
Expand Down

0 comments on commit 7ad9b3d

Please sign in to comment.