From 0bf597c2fdf969fac717f37c0b605b2942e2d319 Mon Sep 17 00:00:00 2001
From: arookieofc <2128194521@qq.com>
Date: Sun, 1 Nov 2026 08:13:15 +0800
Subject: [PATCH] fix(search): make the search popups draggable (#625)
Find in Files, Replace in Files and Search Everywhere have no window title bar, so they could not be moved off the editor underneath. Dialogs can now be dragged from any element marked `data-dialog-drag`: the headers of those search popups, the title of any titled popup, and the existing window title bars and alert bodies, which now use the same mark. Controls inside a handle never start a drag.
Also waits for a review thread inlay in a test where it can mount a tick later.
Co-authored-by: a-rookie-of-C-language <186315048+a-rookie-of-C-language@users.noreply.github.com>
---
src/features/github/diff/reviewDiff.test.tsx | 3 +-
.../search/everywhere/SearchEverywhere.tsx | 2 +-
src/features/search/find/FindInFiles.tsx | 2 +-
src/ui/Dialog.test.tsx | 41 +++++++++++++++++++
src/ui/Dialog.tsx | 15 +++----
5 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/src/features/github/diff/reviewDiff.test.tsx b/src/features/github/diff/reviewDiff.test.tsx
index cbde3dbe..0026892f 100644
--- a/src/features/github/diff/reviewDiff.test.tsx
+++ b/src/features/github/diff/reviewDiff.test.tsx
@@ -216,7 +216,8 @@ describe("review threads in a pull request diff", () => {
expect(right.contains(t1)).toBe(true);
expect(t1.closest(".cm-lineInlay")!.previousElementSibling?.textContent).toBe("line three");
expect(right.querySelectorAll(".cm-reviewControl-toggle")).toHaveLength(2);
- expect(inlay("T2")).not.toBeNull();
+ // Each thread's inlay mounts in its own effect, so T2 may land a tick after T1.
+ await waitFor(() => expect(inlay("T2")).not.toBeNull());
act(() => setReviewDiffSettings({ threadsView: "unresolved" }));
await waitFor(() => expect(inlay("T2")).toBeNull());
diff --git a/src/features/search/everywhere/SearchEverywhere.tsx b/src/features/search/everywhere/SearchEverywhere.tsx
index 86b116fc..f5bd6c41 100644
--- a/src/features/search/everywhere/SearchEverywhere.tsx
+++ b/src/features/search/everywhere/SearchEverywhere.tsx
@@ -394,7 +394,7 @@ function SearchEverywhereDialog() {
aria-label={tx("Search Everywhere")}
className={styles.dialog}
>
-