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: find/replace opening (#1307)

Myles Scolnick7df6c5e00d52
diff --git a/frontend/e2e-tests/mode.spec.ts b/frontend/e2e-tests/mode.spec.ts
index a03c84158e..ce38600645 100644
--- a/frontend/e2e-tests/mode.spec.ts
+++ b/frontend/e2e-tests/mode.spec.ts
@@ -19,6 +19,23 @@ test("page renders edit feature in edit mode", async ({ page }) => {
await takeScreenshot(page, __filename);
});
+test.skip("can bring up the find/replace dialog", async ({ page }) => {
+ const appUrl = getAppUrl("title.py");
+ await page.goto(appUrl);
+
+ // Wait for the cells to load
+ await expect(page.locator("h1").getByText("Hello Marimo!")).toBeVisible();
+
+ // Click mod+f to bring up the find/replace dialog
+ // TODO: This is not working
+ await page.keyboard.press("Meta+f", { delay: 200 });
+
+ // Has placeholder text "Find"
+ await expect(page.locator("[placeholder='Find']")).toBeVisible();
+
+ await takeScreenshot(page, __filename);
+});
+
test("can toggle to presenter mode", async ({ page }) => {
const appUrl = getAppUrl("title.py");
await page.goto(appUrl);
diff --git a/frontend/src/components/indicator.tsx b/frontend/src/components/indicator.tsx
index 36959edb51..cdca1628d4 100644
--- a/frontend/src/components/indicator.tsx
+++ b/frontend/src/components/indicator.tsx
@@ -5,7 +5,7 @@ export const TailwindIndicator = () => {
}
return (
- <div className="fixed bottom-2 right-[220px] z-50 flex size-5 items-center justify-center rounded-lg bg-gray-800 py-3 px-4 font-mono text-xs text-white">
+ <div className="fixed bottom-2 right-[240px] z-50 flex size-5 items-center justify-center rounded-lg bg-gray-800 py-3 px-4 font-mono text-xs text-white">
<div className="block sm:hidden">xs</div>
<div className="hidden sm:block md:hidden lg:hidden xl:hidden 2xl:hidden">
sm
diff --git a/frontend/src/core/codemirror/find-replace/state.ts b/frontend/src/core/codemirror/find-replace/state.ts
index 65b77d11e8..2387be9f37 100644
--- a/frontend/src/core/codemirror/find-replace/state.ts
+++ b/frontend/src/core/codemirror/find-replace/state.ts
@@ -91,9 +91,13 @@ export const findReplaceAtom = atomWithReducer<FindReplaceState, Action>(
export function openFindReplacePanel(initialView?: EditorView): boolean {
// If any radix dialog is open, don't open the find/replace panel
- // they have role="dialog" and data-state="open"
+ // they have role="dialog" and data-state="open" and has children
const element = document.querySelector('[role="dialog"][data-state="open"]');
- if (element) {
+ if (
+ element &&
+ element instanceof HTMLElement &&
+ element.children.length > 0
+ ) {
return false;
}