Skip to content

Commit

Permalink
fix conflicts (#123349)
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal authored Jan 19, 2022
1 parent f30a389 commit a6fd029
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const DocTableInfinite = (props: DocTableProps) => {

const onBackToTop = useCallback(() => {
const isMobileView = document.getElementsByClassName('dscSidebar__mobile').length > 0;
const focusElem = document.querySelector('.dscTable') as HTMLElement;
const focusElem = document.querySelector('.dscSkipButton') as HTMLElement;
focusElem.focus();

// Only the desktop one needs to target a specific container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function DiscoverDocumentsComponent({
}

return (
<EuiFlexItem className="dscTable" tabIndex={-1} aria-labelledby="documentsAriaLabel">
<EuiFlexItem className="dscTable" aria-labelledby="documentsAriaLabel">
<EuiScreenReaderOnly>
<h2 id="documentsAriaLabel">
<FormattedMessage id="discover.documentsAriaLabel" defaultMessage="Documents" />
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/discover/_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.backToTop();
});

it('should go the end of the table when using the accessible Skip button', async function () {
it('should go the end and back to top of the classic table when using the accessible buttons', async function () {
// click the Skip to the end of the table
await PageObjects.discover.skipToEndOfDocTable();
// now check the footer text content
const footer = await PageObjects.discover.getDocTableFooter();
log.debug(await footer.getVisibleText());
expect(await footer.getVisibleText()).to.have.string(rowsHardLimit);
await PageObjects.discover.backToTop();
// check that the skip to end of the table button now has focus
const skipButton = await testSubjects.find('discoverSkipTableButton');
const activeElement = await find.activeElement();
const activeElementText = await activeElement.getVisibleText();
const skipButtonText = await skipButton.getVisibleText();
expect(skipButtonText === activeElementText).to.be(true);
});

describe('expand a document row', function () {
Expand Down

0 comments on commit a6fd029

Please sign in to comment.