diff --git a/src/tests/frontend-new/specs/collab_client.spec.ts b/src/tests/frontend-new/specs/collab_client.spec.ts index 9d4581438..12b89a104 100644 --- a/src/tests/frontend-new/specs/collab_client.spec.ts +++ b/src/tests/frontend-new/specs/collab_client.spec.ts @@ -30,6 +30,11 @@ test.describe('Messages in the COLLABROOM', function () { const div = body.locator('div').nth(lineNumber) + // Click into the editor before keypresses. Each test opens its own + // browser contexts via goToPad, which does not click — previously the + // page-load auto-focus put the editor in focus regardless, but that + // was removed in #7255 so the skip link could be Tab-reachable. + await body.click(); // simulate key presses to delete content await div.locator('span').selectText() // select all await page.keyboard.press('Backspace') // clear the first line diff --git a/src/tests/frontend-new/specs/enter.spec.ts b/src/tests/frontend-new/specs/enter.spec.ts index beb54203a..d5c30eb30 100644 --- a/src/tests/frontend-new/specs/enter.spec.ts +++ b/src/tests/frontend-new/specs/enter.spec.ts @@ -49,7 +49,11 @@ test.describe('enter keystroke', function () { for (let i = 0; i < numberOfLines; i++) { const expectedCount = originalLength + i + 1; const lastLine = padBody.locator('div').last(); - await lastLine.focus(); + // `.focus()` is a no-op on a
(not natively focusable), so click + // the line to put the caret in the editor. Previously the editor was + // auto-focused on page load and this still happened to work; removing + // that auto-focus (#7255) makes the click explicit. + await lastLine.click(); await page.keyboard.press('End'); await page.keyboard.press('Enter'); await expect(padBody.locator('div')).toHaveCount(expectedCount); diff --git a/src/tests/frontend-new/specs/indentation.spec.ts b/src/tests/frontend-new/specs/indentation.spec.ts index a08834537..1190d71cc 100644 --- a/src/tests/frontend-new/specs/indentation.spec.ts +++ b/src/tests/frontend-new/specs/indentation.spec.ts @@ -12,6 +12,10 @@ test.describe('indentation button', function () { // get the first text element out of the inner iframe const $firstTextElement = padBody.locator('div').first(); + // Click first to land focus inside the editor iframe; the load-time + // auto-focus that previously did this was removed in #7255 so Tab + // could reach the skip-to-content link. + await $firstTextElement.click(); // select this text element await $firstTextElement.selectText()