An open-source, faster Devin alternative
TypeScript
fix(web): stop dropdowns inside dialogs from closing the dialog (all modals)
Igor Zalutskia3445e7ccaeb
diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsxindex c33f1d61..98b6535f 100644--- a/web/src/components/ui/dialog.tsx+++ b/web/src/components/ui/dialog.tsx@@ -66,9 +66,18 @@ function DialogContent({onInteractOutside={(event) => {// A Select/Dropdown renders its menu in a portal OUTSIDE this content, so// clicking an item reads as an "interact outside" and would close the- // dialog. Ignore interactions that originate from any popper menu.- const target = event.detail.originalEvent.target as Element | null- if (target?.closest?.('[data-radix-popper-content-wrapper]')) {+ // dialog. Ignore interactions that originate from any popper menu. Null-safe+ // (the custom event's detail shape varies) and matched by role as well as+ // the dynamically-built popper attribute.+ const detail = (event as { detail?: { originalEvent?: Event } })+ .detail+ const target = (detail?.originalEvent?.target ??+ null) as Element | null+ if (+ target?.closest?.(+ '[data-radix-popper-content-wrapper],[role="listbox"],[role="menu"]',+ )+ ) {event.preventDefault()return}