From 9b4a1d46d5afd4883d226d0236f28d298513c5fa Mon Sep 17 00:00:00 2001 From: Melloware Date: Fri, 11 Nov 2022 08:46:07 -0500 Subject: [PATCH] Fix #1866: InputNumber arrows keys don't work tabbing into symbol field (#3614) --- components/lib/inputnumber/InputNumber.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 074fb954a4..ee0b4cf8d3 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -928,6 +928,13 @@ export const InputNumber = React.memo( const onInputFocus = (event) => { setFocusedState(true); props.onFocus && props.onFocus(event); + + if ((props.suffix || props.currency || props.prefix) && inputRef.current) { + // GitHub #1866 Cursor must be placed before/after symbol or arrow keys don't work + const selectionEnd = initCursor(); + + inputRef.current.setSelectionRange(selectionEnd, selectionEnd); + } }; const onInputBlur = (event) => {