From 9719747080b7769fd013ca9c40e1c1ea29230498 Mon Sep 17 00:00:00 2001 From: chahatkesh Date: Sat, 29 Aug 2026 14:24:34 +0530 Subject: [PATCH] fix(ui): trim whitespace on delete confirmation input Copy-pasting a key name into the delete dialog often includes surrounding spaces, which left the Delete button disabled. Compare against the trimmed input so a matching name still unlocks deletion. --- .../common_components/DeleteResourceModal.test.tsx | 13 +++++++++++++ .../common_components/DeleteResourceModal.tsx | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx index 4ff13599a2e..5e771e804ec 100644 --- a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx +++ b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx @@ -121,6 +121,19 @@ describe("DeleteResourceModal", () => { expect(deleteButton).toBeEnabled(); }); + it("should enable delete button when the confirmation input matches after surrounding whitespace is trimmed", () => { + renderWithProviders(); + const input = screen.getByPlaceholderText("prod-key"); + fireEvent.change(input, { target: { value: " prod-key " } }); + expect(screen.getByRole("button", { name: /delete/i })).toBeEnabled(); + }); + + it("should keep delete disabled when trimmed confirmation input still does not match", () => { + renderWithProviders(); + fireEvent.change(screen.getByPlaceholderText("prod-key"), { target: { value: " other-key " } }); + expect(screen.getByRole("button", { name: /delete/i })).toBeDisabled(); + }); + it("should reset requiredConfirmation input when modal opens", async () => { const user = userEvent.setup(); const { rerender } = renderWithProviders(); diff --git a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx index 2d8a523397a..6f9a99cc164 100644 --- a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx +++ b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx @@ -101,7 +101,9 @@ export default function DeleteResourceModal({