diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 941c25fa83..6845493335 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -853,9 +853,11 @@ export const InputNumber = React.memo( selectionEnd = sRegex.lastIndex + tRegex.lastIndex; inputEl.setSelectionRange(selectionEnd, selectionEnd); } else if (newLength === currentLength) { - if (operation === 'insert' || operation === 'delete-back-single') inputEl.setSelectionRange(selectionEnd + 1, selectionEnd + 1); - else if (operation === 'delete-single') inputEl.setSelectionRange(selectionEnd - 1, selectionEnd - 1); - else if (operation === 'delete-range' || operation === 'spin') inputEl.setSelectionRange(selectionEnd, selectionEnd); + if (['insert', 'delete-back-single', 'delete-range', 'spin'].includes(operation)) { + inputEl.setSelectionRange(selectionEnd, selectionEnd); + } else if (operation === 'delete-single') { + inputEl.setSelectionRange(selectionEnd - 1, selectionEnd - 1); + } } else if (operation === 'delete-back-single') { let prevChar = inputValue.charAt(selectionEnd - 1); let nextChar = inputValue.charAt(selectionEnd);