Skip to content

Commit

Permalink
Scope focusable row to the scroll container, refs STCOM-870, ERM-815 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-mat authored Aug 24, 2021
1 parent 6da288f commit 1c9c515
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* `<SingleSelect>` add new `loading` and `loadingMessage` props to display while loading options. Refs STCOM-858.
* Applied maxheight to `<DropdownMenu>`. Fixes STCOM-848
* Fix `<Datepicker>` `inputRef` prop not working. Refs STCOM-869
* Scope the focusable row to the scroll container. Refs STCOM-870

## [9.2.0](https://github.com/folio-org/stripes-components/tree/v9.2.0) (2021-06-08)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v9.1.0...v9.2.0)
Expand Down
14 changes: 8 additions & 6 deletions lib/MultiColumnList/MCLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ class MCLRenderer extends React.Component {
}
} else if (pagingType === 'click' || pagingType === 'prev-next') {
if (this.focusTargetIndex) {
const target = document.querySelector(`[data-row-index="row-${this.focusTargetIndex}"]`);
const { current } = this.scrollContainer;
const target = current && current.querySelector(`[data-row-index="row-${this.focusTargetIndex}"]`);

if (target) {
const inner = getNextFocusable(target, true, true);
const elem = inner || target;
Expand Down Expand Up @@ -567,7 +569,7 @@ class MCLRenderer extends React.Component {
}

if (contentData.length !== 0 &&
!virtualize) {
!virtualize) {
this.scrollToItemToView();
}
}
Expand Down Expand Up @@ -936,7 +938,7 @@ class MCLRenderer extends React.Component {
onClick,
onKeyDown,
'style': defaultStyle,
'data-row-inner' : rowIndex,
'data-row-inner': rowIndex,
};

const cellObject = this.renderCells(rowIndex, this.getRowData(rowIndex));
Expand Down Expand Up @@ -1117,7 +1119,7 @@ class MCLRenderer extends React.Component {
shouldPosition={!staticBody}
rowIndex={endIndex}
>
{ ({ position }) => {
{({ position }) => {
return (
<div data-end-of-list={endIndex} className={css.mclEndOfListContainer} style={{ top: `${position}px` }}>
<CenteredContainer
Expand Down Expand Up @@ -1568,7 +1570,7 @@ class MCLRenderer extends React.Component {
style={headerStyle}
id={columnId}
>
{ headerInner }
{headerInner}
</div>
</CellMeasurer>
);
Expand Down Expand Up @@ -1754,7 +1756,7 @@ class MCLRenderer extends React.Component {
tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
ref={this.container}
>
{ typeof isEmptyMessage === 'string' ? <EmptyMessage>{isEmptyMessage}</EmptyMessage> : isEmptyMessage }
{typeof isEmptyMessage === 'string' ? <EmptyMessage>{isEmptyMessage}</EmptyMessage> : isEmptyMessage}
</div>
);
}
Expand Down

0 comments on commit 1c9c515

Please sign in to comment.