Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix playwright slides test, and fix sizing (#9642)

Shahmir Varqha973f0736283b
diff --git a/frontend/e2e-tests/screenshots/slides.0.png b/frontend/e2e-tests/screenshots/slides.0.png
index 00979e6a03..608891a626 100644
Binary files a/frontend/e2e-tests/screenshots/slides.0.png and b/frontend/e2e-tests/screenshots/slides.0.png differ
diff --git a/frontend/e2e-tests/screenshots/slides.1.png b/frontend/e2e-tests/screenshots/slides.1.png
index 35e69e19fb..21cbcd15db 100644
Binary files a/frontend/e2e-tests/screenshots/slides.1.png and b/frontend/e2e-tests/screenshots/slides.1.png differ
diff --git a/frontend/e2e-tests/slides.spec.ts b/frontend/e2e-tests/slides.spec.ts
index 59ab91dbd4..8eb70fa4b2 100644
--- a/frontend/e2e-tests/slides.spec.ts
+++ b/frontend/e2e-tests/slides.spec.ts
@@ -30,27 +30,31 @@ test("slides", async ({ page }) => {
await takeScreenshot(page, __filename);
- // Reveal.js marks the active slide <section> with .present. We match by
- // `data-index-h` (which reveal sets on each slide section)
- const slides = slidesContainer.locator("section[data-index-h]");
- await expect(slides.first()).toHaveClass(/present/);
-
- // Focus the deck so keyboard navigation works (embedded mode)
+ // Reveal.js marks the active slide <section> with `.present`. It only sets
+ // `data-index-h` in overview / scroll modes, so we identify each slide
+ // positionally via `.slides > section` and assert which one is active.
+ const slides = slidesContainer.locator(".slides > section");
+ await expect(slides).toHaveCount(2);
+ await expect(slides.nth(0)).toHaveClass(/present/);
+
+ // Click the deck so DOM focus lands on it (the wrapper is `tabindex="-1"`).
+ // Without this, focus stays on whatever the command palette dialog
+ // restored it to (often the speaker-notes textarea), which makes reveal
+ // ignore the arrow keys.
await slidesContainer.click();
+ await expect
+ .poll(() =>
+ slidesContainer.evaluate((el) => document.activeElement === el),
+ )
+ .toBe(true);
- // Navigate to next slide using right arrow key
await page.keyboard.press("ArrowRight");
-
- // Verify we moved to second slide
await expect(slides.nth(1)).toHaveClass(/present/);
await takeScreenshot(page, __filename);
- // Navigate back to first slide using left arrow key
await page.keyboard.press("ArrowLeft");
-
- // Verify we're back on the first slide
- await expect(slides.first()).toHaveClass(/present/);
+ await expect(slides.nth(0)).toHaveClass(/present/);
});
test("slides fullscreen", async ({ page }) => {
diff --git a/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx b/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
index 9b4c1edad5..130b00c75f 100644
--- a/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
+++ b/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
@@ -83,7 +83,7 @@ export const SlidesLayoutRenderer: React.FC<Props> = ({
}
return (
- <div className="pr-18 pb-2 flex flex-row gap-2 min-h-0">
+ <div className="flex-1 pr-18 pb-2 flex flex-row gap-2 min-h-0">
<SlidesMinimap
cells={cellsWithOutput}
thumbnailWidth={220}
diff --git a/frontend/src/components/slides/reveal-component.tsx b/frontend/src/components/slides/reveal-component.tsx
index d3abba1a45..850adfb88b 100644
--- a/frontend/src/components/slides/reveal-component.tsx
+++ b/frontend/src/components/slides/reveal-component.tsx
@@ -357,6 +357,16 @@ const RevealSlidesComponent = ({
toggleShowCode,
);
}
+
+ // Reveal listens for `keydown` on `document` and bails when
+ // `document.activeElement` is an input/contenteditable (e.g. the speaker
+ // notes textarea below the deck). Park focus on the deck wrapper so arrow
+ // keys reliably advance slides without the user having to click first.
+ const revealEl = deck.getSlidesElement()?.closest(".reveal");
+ if (revealEl instanceof HTMLElement) {
+ revealEl.tabIndex = -1;
+ revealEl.focus({ preventScroll: true });
+ }
});
const activeSubslide = useMemo(() => {