Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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