From 4f2faf2326c76ecb6a05137c372b938831541639 Mon Sep 17 00:00:00 2001 From: Balazs Bajorics <2226774+balazsbajorics@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:49:09 +0200 Subject: [PATCH] NumberInput: holding arrow up-down makes the updates transient (#6378) **Problem:** The `NumberInput` component which is used all over the inspector did not properly handle when the arrow up/down keys were pressed and held. **Fix:** It _looks like_ this did not work in the last 4 years! Amazingly, all of the proper handling _was_ wired in, but then instead of passing in a true flag, the code passed in a false flag, which made every event non-transient. Weird! **Commit Details:** - Just passing in `true` as `incrementBy`'s transient parameter --- editor/src/uuiui/inputs/number-input.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/src/uuiui/inputs/number-input.tsx b/editor/src/uuiui/inputs/number-input.tsx index d0fcfc5ff9f3..8f20d453a91d 100644 --- a/editor/src/uuiui/inputs/number-input.tsx +++ b/editor/src/uuiui/inputs/number-input.tsx @@ -467,10 +467,10 @@ export const NumberInput = React.memo( const onKeyDown = React.useCallback( (e: React.KeyboardEvent) => { if (e.key === 'ArrowUp') { - updateValue(incrementBy(stepSize, e.shiftKey, false)) + updateValue(incrementBy(stepSize, e.shiftKey, true)) } else if (e.key === 'ArrowDown') { e.preventDefault() - updateValue(incrementBy(-stepSize, e.shiftKey, false)) + updateValue(incrementBy(-stepSize, e.shiftKey, true)) } else if (e.key === 'Enter' || e.key === 'Escape') { e.nativeEvent.stopImmediatePropagation() e.preventDefault()