diff --git a/src/table/src/TableRow.js b/src/table/src/TableRow.js index fd8adeb6f..7196a391f 100644 --- a/src/table/src/TableRow.js +++ b/src/table/src/TableRow.js @@ -54,11 +54,21 @@ export default class TableRow extends PureComponent { } } + onRef = node => { + this.node = node + } + handleKeyPress = e => { if (this.props.isSelectable) { if (e.key === 'Enter' || e.key === ' ') { this.props.onSelect() - e.preventDefault() + + // NOTE: In scenarios where the target for key press is our + // tabIndex below, prevent the default event action + // so that browser scroll will not occur. + if (e.target === this.node) { + e.preventDefault() + } } } @@ -83,6 +93,7 @@ export default class TableRow extends PureComponent { return ( TableRow )) + .add('TableRow isSelectable with nested UI', () => ( + + {(() => { + document.body.style.margin = '0' + document.body.style.height = '100vh' + })()} + + + + + )) .add('TableHeaderCell', () => ( {(() => {