Sidebar thread rows dialog closes after dragging a layout item and clicking inside the dialog

Offen Anfängerfreundlich
#45,571 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
76/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
react, typescript
Bereich
frontend

Rechercherichtung

Beginne in apps/web/src/components/settings/SidebarRowLayoutRow.tsx und untersuche SidebarRowLayoutEditor's DragOverlay zusammen mit der Aktivierungsbedingung von PointerSensor. Reproduziere die im Issue beschriebene Abfolge aus Ziehen und Klicken und überprüfe dann, ob der Fix den Dialog geöffnet hält und die Textauswahl auf dem Chip verhindert. Prüfe das gleiche Overlay-Muster in apps/web/src/components/chat/ThreadDetailsBlocks.tsx für das zugehörige Popover.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

via-triage
What happened

In Settings → Appearance → Sidebar thread rows ("Customize"), dragging a layout item (such as space) and then clicking or slightly dragging inside the dialog causes the dialog to close unexpectedly. It does not always happen in one shot.

https://github.com/user-attachments/assets/538d46fc-33c1-4e84-9249-a7222e28140b

Diagnosis
  • SidebarRowLayoutEditor (apps/web/src/components/settings/SidebarRowLayoutRow.tsx:394-399) portals <DragOverlay dropAnimation={null} zIndex={100}> into document.body (outside Base UI's DialogPopup) without pointer-events-none (pointer-events: none).
  • When a drag exceeds PointerSensor's activationConstraint: { distance: 4 } (SidebarRowLayoutRow.tsx:198), DragOverlay mounts directly under the pointer. On release, pointerup hits DragOverlay and @dnd-kit's onDragEnd unmounts DragOverlay synchronously before mouseup, so mouseup lands on document.body. Because mousedown was inside DialogPopup and mouseup landed on document.body, the browser dispatches click on their nearest common ancestor (document.body).
  • Base UI's useDismiss capture listener (closeOnPressOutsideCapture) sees that click on document.body and attaches a one-shot bubble click listener onto document.body. Immediately afterward in the capture phase, @dnd-kit's AbstractPointerSensor calls stopPropagation() on that click event, leaving the one-shot bubble listener armed on document.body.
  • On the next non-drag click anywhere inside the dialog (after @dnd-kit's 50 ms capture cleanup—including a < 4px press/micro-drag that doesn't activate PointerSensor), useDismiss clears insideReactTree during the inner click; as the click bubbles up to document.body, the stale listener fires with target === document.body. Since document.body contains popupElement, DialogInteractions.outsidePress returns true and closes the dialog with reason: "outside-press".
  • Additionally, DraggableChip (SidebarRowLayoutRow.tsx:474-489) omits select-none, so moving <= 4px before PointerSensor activates selects chip text (e.g. "pace" in "space").
  • Note: ThreadDetailsBlocks (apps/web/src/components/chat/ThreadDetailsBlocks.tsx:205-220) uses the same <DragOverlay dropAnimation={null} zIndex={100}> portal to document.body without pointer-events-none inside ThreadDetailsCard's Base UI Popover.
Steps to reproduce
  1. Open Settings → Appearance → Sidebar thread rows → Customize.
  2. Press and drag any layout chip (for example space) more than 4 px, then release. (The dialog stays open.)
  3. Wait > 50 ms, then click anywhere inside the dialog—or press on space and move < 4px before releasing.
  4. Expected: The dialog stays open and chip text is not selected.
  5. Actual: The dialog closes immediately.
Version

0.1.14-nightly.20261129.5438 (commit 7cb8305e3a; also present on main at d17aa43c82)

Environment

T3 Code Desktop 0.1.14-nightly.20261129.5438, Linux x64 (7.3.5-200.fc44.x86_64), Node v24.22.1, Chromium 152 / Electron 44.10.1

Evidence
Reproduced in Playwright Chromium against `@base-ui/react` 1.9.0 + `@dnd-kit/core` 6.3.1:


=== A. Drag 20px right once -> open=true ===
  {"type":"dnd:start","id":"top-spacer-0"}
  {"type":"doc:pointerup","t":584,"target":"SPAN.","selection":""}
  {"type":"dnd:end"}
  {"type":"doc:mouseup","t":609,"target":"BODY.","selection":""}
  {"type":"doc:click","t":610,"target":"BODY.","selection":""}

=== B. Click once after Drag A -> open=false ===
  {"type":"doc:pointerup","t":677,"target":"SPAN.","selection":""}
  {"type":"doc:mouseup","t":685,"target":"SPAN.","selection":""}
  {"type":"doc:click","t":686,"target":"SPAN.","selection":""}
  {"type":"dialog:openChange","t":689,"open":false,"reason":"outside-press","eventType":"click","targetTag":"BODY"}


Adding `pointer-events: none` to `<DragOverlay>` prevented `mouseup`/`click` from falling onto `document.body` and kept `open=true` across all drag and click sequences.
Related issues

Introduced in #42576. Similar in mechanism to #45028 (a press/release across element boundaries resolves click to an ancestor outside the popup), though here the cause is an unmounted portaled DragOverlay without pointer-events: none interacting with Base UI useDismiss.

Fix applied or workaround

None applied locally. Workaround: move layout items using the arrow keys while a chip is focused, or avoid clicking inside the dialog after a pointer drag.

Filed by

antigravity (gemini-4-hydrogen) via t3 triage

Vorherrschende Sprache
TypeScript
Sterne
24.8k
Forks
6.4k
Ø Merge
59 Min.
Gemergte PRs (30 T.)
613

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pingdotgg/t3code

Alle Issues in pingdotgg/t3code

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.