Skip to content

Commit

Permalink
Fix #2843: InputNumber respect autoFocus on spin buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed May 5, 2022
1 parent 1cb911c commit d58debf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => {
let currentValue = parseValue(inputRef.current.value) || 0;
let newValue = validateValue(currentValue + step);

updateInput(newValue, null, 'spin');
props.autoFocus && updateInput(newValue, null, 'spin');
updateModel(event, newValue);

handleOnChange(event, currentValue, newValue);
Expand All @@ -191,7 +191,7 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => {

const onUpButtonMouseDown = (event) => {
if (!props.disabled && !props.readOnly) {
inputRef.current.focus();
props.autoFocus && inputRef.current.focus();
repeat(event, null, 1);
event.preventDefault();
}
Expand Down Expand Up @@ -223,7 +223,7 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => {

const onDownButtonMouseDown = (event) => {
if (!props.disabled && !props.readOnly) {
inputRef.current.focus();
props.autoFocus && inputRef.current.focus();
repeat(event, null, -1);

event.preventDefault();
Expand Down

0 comments on commit d58debf

Please sign in to comment.