From 85236464d42e5a0a630f5c66cfe0f46f1ddaf821 Mon Sep 17 00:00:00 2001 From: Geoffroy Baccarini Date: Mon, 23 Dec 2024 10:47:08 +0100 Subject: [PATCH] fix(InlineEdit): edge case when a field is required with blank spaces --- .changeset/ten-paws-love.md | 5 +++++ .../InlineEditing/Primitives/InlineEditingPrimitive.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/ten-paws-love.md diff --git a/.changeset/ten-paws-love.md b/.changeset/ten-paws-love.md new file mode 100644 index 00000000000..61a8e85a1cb --- /dev/null +++ b/.changeset/ten-paws-love.md @@ -0,0 +1,5 @@ +--- +'@talend/design-system': patch +--- + +InlineEdit - Fix been able to submit field when required and having blank spaces diff --git a/packages/design-system/src/components/InlineEditing/Primitives/InlineEditingPrimitive.tsx b/packages/design-system/src/components/InlineEditing/Primitives/InlineEditingPrimitive.tsx index ce3b74a7a85..b6a490ec380 100644 --- a/packages/design-system/src/components/InlineEditing/Primitives/InlineEditingPrimitive.tsx +++ b/packages/design-system/src/components/InlineEditing/Primitives/InlineEditingPrimitive.tsx @@ -140,7 +140,7 @@ const InlineEditingPrimitive = forwardRef( // eslint-disable-next-line react-hooks/exhaustive-deps const getValue = () => (onChangeValue ? value : internalValue); const inputIsValid = () => { - return !required || !!getValue(); + return !required || !!getValue()?.trim(); }; const toggleEditionMode = (isEditionMode: boolean) => {