From 59af07a9d787ada6ee695b4a72b1e8331c3dadb5 Mon Sep 17 00:00:00 2001 From: Gbacc Date: Mon, 23 Dec 2024 11:15:19 +0100 Subject: [PATCH] fix(InlineEdit): edge case when a field is required with blank spaces (#5481) --- .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) => {