diff --git a/src/plugins/discover/public/application/apps/main/components/doc_table/doc_table_infinite.tsx b/src/plugins/discover/public/application/apps/main/components/doc_table/doc_table_infinite.tsx index 0f06b4f677758..6d96cd31151e7 100644 --- a/src/plugins/discover/public/application/apps/main/components/doc_table/doc_table_infinite.tsx +++ b/src/plugins/discover/public/application/apps/main/components/doc_table/doc_table_infinite.tsx @@ -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 diff --git a/src/plugins/discover/public/application/apps/main/components/layout/discover_documents.tsx b/src/plugins/discover/public/application/apps/main/components/layout/discover_documents.tsx index 793d850bf63d7..2b18647bbbc8d 100644 --- a/src/plugins/discover/public/application/apps/main/components/layout/discover_documents.tsx +++ b/src/plugins/discover/public/application/apps/main/components/layout/discover_documents.tsx @@ -120,7 +120,7 @@ function DiscoverDocumentsComponent({ } return ( - +

diff --git a/test/functional/apps/discover/_doc_table.ts b/test/functional/apps/discover/_doc_table.ts index f6f60d4fd6393..794204b923b72 100644 --- a/test/functional/apps/discover/_doc_table.ts +++ b/test/functional/apps/discover/_doc_table.ts @@ -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 () {