From cc3c0d1874acc68642e53d54c0b49258d1205db6 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Mon, 20 Jan 2025 10:31:28 +0100 Subject: [PATCH] Release 0.0.123 --- package.json | 2 +- src/components/CodeValidation/CodeValidation.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 418f9e99..24a19bf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@surfnet/sds", - "version": "0.0.122", + "version": "0.0.123", "description": "SURF Design System for React", "type": "module", "main": "cjs/index.js", diff --git a/src/components/CodeValidation/CodeValidation.tsx b/src/components/CodeValidation/CodeValidation.tsx index 4d856f98..1bea34cb 100644 --- a/src/components/CodeValidation/CodeValidation.tsx +++ b/src/components/CodeValidation/CodeValidation.tsx @@ -25,10 +25,11 @@ const CodeValidation = (props: CodeValidationProps) => { const disabled = props.disabled || false; useEffect(() => { + const emptyValues = isEmpty(values.join("")); if (props.clear) { setValues(Array(props.size).fill("")); } - if ((props.focusFirst || true) && !props.disabled) { + if (emptyValues && (props.focusFirst || true) && !props.disabled) { const firstElement = inputRefs.current[0]; setTimeout(() => firstElement.focus(), timeout); }