Repository navigation
Closed
Labels
Description
focus handling tests have regressed on Windows 32-bit in the Chromium roll (#45172) 133.0.6920.0..134.0.6968.0
not ok 1465 focus handling a TAB press moves focus to the next focusable item
focus should've moved to the webview's element-2, it's instead in BUTTON-wv-element-1: expected 'BUTTON-wv-element-1' to equal 'BUTTON-wv-element-2'
AssertionError: focus should've moved to the webview's element-2, it's instead in BUTTON-wv-element-1: expected 'BUTTON-wv-element-1' to equal 'BUTTON-wv-element-2'
at Context.<anonymous> (electron\spec\chromium-spec.ts:159:35)
[1956:0123/195544.605:WARNING:render_input_router.cc(41)] Input request on unbound interface
[1956:0123/195615.443:WARNING:render_input_router.cc(41)] Input request on unbound interface
[1956:0123/195616.297:WARNING:render_input_router.cc(41)] Input request on unbound interface
[1956:0123/195647.125:WARNING:render_input_router.cc(41)] Input request on unbound interface
not ok 1466 focus handling a SHIFT + TAB press moves focus to the previous focusable item
focus should've moved to the webview's element-1, it's instead in BUTTON-wv-element-2: expected 'BUTTON-wv-element-2' to equal 'BUTTON-wv-element-1'
AssertionError: focus should've moved to the webview's element-1, it's instead in BUTTON-wv-element-2: expected 'BUTTON-wv-element-2' to equal 'BUTTON-wv-element-1'
at Context.<anonymous> (electron\spec\chromium-spec.ts:194:35)
electron/spec/chromium-spec.ts
Lines 101 to 212 in aafb1ba
| describe('focus handling', () => { | |
| let webviewContents: WebContents; | |
| let w: BrowserWindow; | |
| beforeEach(async () => { | |
| w = new BrowserWindow({ | |
| show: true, | |
| webPreferences: { | |
| nodeIntegration: true, | |
| webviewTag: true, | |
| contextIsolation: false | |
| } | |
| }); | |
| const webviewReady = once(w.webContents, 'did-attach-webview') as Promise<[any, WebContents]>; | |
| await w.loadFile(path.join(fixturesPath, 'pages', 'tab-focus-loop-elements.html')); | |
| const [, wvContents] = await webviewReady; | |
| webviewContents = wvContents; | |
| await once(webviewContents, 'did-finish-load'); | |
| w.focus(); | |
| }); | |
| afterEach(() => { | |
| webviewContents = null as unknown as WebContents; | |
| w.destroy(); | |
| w = null as unknown as BrowserWindow; | |
| }); | |
| const expectFocusChange = async () => { | |
| const [, focusedElementId] = await once(ipcMain, 'focus-changed'); | |
| return focusedElementId; | |
| }; | |
| describe('a TAB press', () => { | |
| const tabPressEvent: any = { | |
| type: 'keyDown', | |
| keyCode: 'Tab' | |
| }; | |
| it('moves focus to the next focusable item', async () => { | |
| let focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(tabPressEvent); | |
| let focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-1', `should start focused in element-1, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(tabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-2', `focus should've moved to element-2, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(tabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-wv-element-1', `focus should've moved to the webview's element-1, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| webviewContents.sendInputEvent(tabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-wv-element-2', `focus should've moved to the webview's element-2, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| webviewContents.sendInputEvent(tabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-3', `focus should've moved to element-3, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(tabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-1', `focus should've looped back to element-1, it's instead in ${focusedElementId}`); | |
| }); | |
| }); | |
| describe('a SHIFT + TAB press', () => { | |
| const shiftTabPressEvent: any = { | |
| type: 'keyDown', | |
| modifiers: ['Shift'], | |
| keyCode: 'Tab' | |
| }; | |
| it('moves focus to the previous focusable item', async () => { | |
| let focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(shiftTabPressEvent); | |
| let focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-3', `should start focused in element-3, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(shiftTabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-wv-element-2', `focus should've moved to the webview's element-2, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| webviewContents.sendInputEvent(shiftTabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-wv-element-1', `focus should've moved to the webview's element-1, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| webviewContents.sendInputEvent(shiftTabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-2', `focus should've moved to element-2, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(shiftTabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-1', `focus should've moved to element-1, it's instead in ${focusedElementId}`); | |
| focusChange = expectFocusChange(); | |
| w.webContents.sendInputEvent(shiftTabPressEvent); | |
| focusedElementId = await focusChange; | |
| expect(focusedElementId).to.equal('BUTTON-element-3', `focus should've looped back to element-3, it's instead in ${focusedElementId}`); | |
| }); | |
| }); | |
| }); |
Activity
jkleinsc commentedon Feb 3, 2025
The test is also flaky on Windows ARM64:
https://github.com/electron/electron/actions/runs/13114221716/job/36590890024