Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(api-keys): Close modal when clicking backdrop (#15237)

Ben Bachem1747d494bf95
diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsx
index 875dcba0f7..7787edcd58 100644
--- a/web/src/components/ui/dialog.tsx
+++ b/web/src/components/ui/dialog.tsx
@@ -78,12 +78,15 @@ const dialogContentVariants = cva(
const DialogContent = React.forwardRef<
React.ComponentRef<typeof DialogPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
- closeOnInteractionOutside?: boolean;
- confirmCloseOnEscape?: string;
- overlayMode?: DialogOverlayMode;
- stopPropagationOnEnterSpace?: boolean;
- } & VariantProps<typeof dialogContentVariants>
+ Omit<
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
+ closeOnInteractionOutside?: boolean;
+ confirmCloseOnEscape?: string;
+ overlayMode?: DialogOverlayMode;
+ stopPropagationOnEnterSpace?: boolean;
+ } & VariantProps<typeof dialogContentVariants>,
+ "onPointerDownOutside" | "onInteractOutside"
+ >
>(
(
{
diff --git a/web/src/features/prompts/components/PromptVersionDiffDialog.tsx b/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
index 9d5c3cd3d2..5ea9711630 100644
--- a/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
+++ b/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
@@ -87,10 +87,7 @@ export const PromptVersionDiffDialog: React.FC<PromptVersionDiffDialogProps> = (
size="xl"
// prevent event bubbling up and triggering the row's click handler
onClick={(event) => event.stopPropagation()}
- onPointerDownOutside={(e) => {
- setIsOpen(false);
- e.stopPropagation();
- }}
+ closeOnInteractionOutside
>
<DialogHeader>
<DialogTitle>
diff --git a/web/src/features/public-api/components/ApiKeyCreateDialogContent.tsx b/web/src/features/public-api/components/ApiKeyCreateDialogContent.tsx
index 6ffed477eb..eb083652ae 100644
--- a/web/src/features/public-api/components/ApiKeyCreateDialogContent.tsx
+++ b/web/src/features/public-api/components/ApiKeyCreateDialogContent.tsx
@@ -38,7 +38,7 @@ export function ApiKeyCreateDialogContent(
const { secretKey, publicKey, baseUrl } = props;
return (
- <DialogContent onPointerDownOutside={(e) => e.preventDefault()}>
+ <DialogContent closeOnInteractionOutside>
<DialogHeader>
<DialogTitle>API Keys</DialogTitle>
</DialogHeader>
@@ -58,7 +58,7 @@ export function ApiKeyCreateDialogContent(
const { note, onNoteChange, onSubmit, isPending } = props;
return (
- <DialogContent onPointerDownOutside={(e) => e.preventDefault()}>
+ <DialogContent closeOnInteractionOutside>
<DialogHeader>
<DialogTitle>Create API Keys</DialogTitle>
</DialogHeader>