diff --git a/src/ui/material/draw_helpers.h b/src/ui/material/draw_helpers.h index 23301bc..fd2d1db 100644 --- a/src/ui/material/draw_helpers.h +++ b/src/ui/material/draw_helpers.h @@ -982,7 +982,10 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth cardGlass.borderWidth = 1.0f; DrawGlassPanel(dl, cardMin, cardMax, cardGlass); - if (p_open && ImGui::IsMouseClicked(ImGuiMouseButton_Left) && + // Click outside the card dismisses the dialog — but NOT on the frame it first appears, otherwise + // the very click that opened it (a button fired the same frame) is read as an outside-click and + // the dialog flashes open then instantly closes. + if (p_open && !ImGui::IsWindowAppearing() && ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !ImGui::IsMouseHoveringRect(cardMin, cardMax, false)) { *p_open = false; }