diff --git a/packages/context-menu/test/a11y.common.js b/packages/context-menu/test/a11y.common.js index 9f1c2562ad..9b69049184 100644 --- a/packages/context-menu/test/a11y.common.js +++ b/packages/context-menu/test/a11y.common.js @@ -6,19 +6,19 @@ import { getMenuItems } from './helpers.js'; describe('a11y', () => { describe('focus restoration', () => { - let contextMenu, contextMenuButton, beforeButton, afterButton; + let contextMenu, contextMenuButton, firstGlobalFocusable, lastGlobalFocusable; beforeEach(async () => { const wrapper = fixtureSync(`
- + - +
`); - [beforeButton, contextMenu, afterButton] = wrapper.children; + [firstGlobalFocusable, contextMenu, lastGlobalFocusable] = wrapper.children; contextMenu.items = [{ text: 'Item 0' }, { text: 'Item 1', children: [{ text: 'Item 1/0' }] }]; await nextRender(); contextMenuButton = contextMenu.querySelector('button'); @@ -82,14 +82,14 @@ describe('a11y', () => { await sendKeys({ down: 'Shift' }); await sendKeys({ press: 'Tab' }); await sendKeys({ up: 'Shift' }); - expect(getDeepActiveElement()).to.equal(beforeButton); + expect(getDeepActiveElement()).to.equal(firstGlobalFocusable); }); it('should move focus to the next element outside the menu on Tab pressed inside', async () => { contextMenuButton.click(); await nextRender(); await sendKeys({ press: 'Tab' }); - expect(getDeepActiveElement()).to.equal(afterButton); + expect(getDeepActiveElement()).to.equal(lastGlobalFocusable); }); }); }); diff --git a/packages/grid/test/keyboard-navigation.common.js b/packages/grid/test/keyboard-navigation.common.js index f90f81c63f..46d0ff57cf 100644 --- a/packages/grid/test/keyboard-navigation.common.js +++ b/packages/grid/test/keyboard-navigation.common.js @@ -2233,7 +2233,7 @@ describe('empty state', () => {
- No items + No items
`); diff --git a/packages/rich-text-editor/test/a11y.common.js b/packages/rich-text-editor/test/a11y.common.js index cb17212bdb..8f2da5af2c 100644 --- a/packages/rich-text-editor/test/a11y.common.js +++ b/packages/rich-text-editor/test/a11y.common.js @@ -178,15 +178,15 @@ describe('accessibility', () => { it('should move focus to next element after esc followed by tab are pressed', async () => { const wrapper = fixtureSync(`
- +
`); await nextRender(); - const [rte, button] = wrapper.children; + const [rte, lastGlobalFocusable] = wrapper.children; editor = rte._editor; editor.focus(); await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Tab' }); - expect(document.activeElement).to.equal(button); + expect(document.activeElement).to.equal(lastGlobalFocusable); }); it('should move focus to the first toolbar button after esc followed by shift-tab are pressed', async () => { @@ -201,17 +201,17 @@ describe('accessibility', () => { it('should restore default Tab behavior after multiple Esc and then Tab', async () => { const wrapper = fixtureSync(`
- +
`); await nextRender(); - const [rte, button] = wrapper.children; + const [rte, lastGlobalFocusable] = wrapper.children; editor = rte._editor; editor.focus(); // Hitting Escape multiple times and Tab should move focus to next element await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Tab' }); - expect(document.activeElement).to.equal(button); + expect(document.activeElement).to.equal(lastGlobalFocusable); // Checking that default Tab behavior is restored editor.focus(); diff --git a/packages/virtual-list/test/drag-and-drop.common.js b/packages/virtual-list/test/drag-and-drop.common.js index 4c443504ab..a3c4639102 100644 --- a/packages/virtual-list/test/drag-and-drop.common.js +++ b/packages/virtual-list/test/drag-and-drop.common.js @@ -38,6 +38,7 @@ describe('drag and drop', () => { async function assertDragSucceeds(draggedElement) { await dragElement(draggedElement); + await nextFrame(); expect(virtualList.$.items.style.display).to.equal(''); }