From c1893c73d139c2006208dbbce5d23a8ae6d52e09 Mon Sep 17 00:00:00 2001 From: Plateau Nguyen Date: Fri, 20 Mar 2026 06:48:48 +0700 Subject: [PATCH] fix: normalize delete confirmation matching (#290) --- .../src/components/shared/confirm-delete-dialog.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/web/src/components/shared/confirm-delete-dialog.tsx b/ui/web/src/components/shared/confirm-delete-dialog.tsx index 5b86159d..0f32f15b 100644 --- a/ui/web/src/components/shared/confirm-delete-dialog.tsx +++ b/ui/web/src/components/shared/confirm-delete-dialog.tsx @@ -35,13 +35,16 @@ export function ConfirmDeleteDialog({ const { t } = useTranslation("common"); const [inputValue, setInputValue] = useState(""); + const normalizeForCompare = (value: string) => value.normalize("NFC").trim().toLocaleLowerCase(); + const confirmationTarget = confirmValue.trim() || confirmValue; + useEffect(() => { if (!open) setInputValue(""); }, [open]); const isMatch = confirmValue - ? inputValue.toLowerCase() === confirmValue.toLowerCase() - : inputValue.length > 0; + ? normalizeForCompare(inputValue) === normalizeForCompare(confirmValue) + : inputValue.trim().length > 0; return ( @@ -52,12 +55,12 @@ export function ConfirmDeleteDialog({

- {t("typeToConfirmPrefix")} {confirmValue} {t("typeToConfirmSuffix")} + {t("typeToConfirmPrefix")} {confirmationTarget} {t("typeToConfirmSuffix")}

setInputValue(e.target.value)} - placeholder={confirmValue} + placeholder={confirmationTarget} autoFocus />