From d5007343e5ebbcb8588bd76f5f66d41eb6f5c8a6 Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Sat, 15 Oct 2022 11:28:36 +0200 Subject: [PATCH] better logic --- .../shared/css-value-input/css-value-input.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx index 966b135482..38b3c36541 100644 --- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx +++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx @@ -130,13 +130,13 @@ const useScrub = (options: { }) => { const inputRef = useRef(null); const optionsRef = useRef(options); - const hasScrubbed = useRef(false); + const shouldSelect = useRef(true); const handlePointerUp = () => { - if (hasScrubbed.current === false) { + if (shouldSelect.current) { inputRef.current?.select(); } - hasScrubbed.current = false; + shouldSelect.current = true; }; useEffect(() => { @@ -150,7 +150,7 @@ const useScrub = (options: { const scrub = numericScrubControl(inputRef.current, { initialValue: value.value, onValueInput(event) { - hasScrubbed.current = true; + shouldSelect.current = false; onChange({ ...value, value: event.value,