Skip to content

Commit

Permalink
Fix #3951/#3943: InputNumber mobile spin handling (#3959)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 22, 2023
1 parent 1c59f03 commit 567f3e8
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,6 @@ export const InputNumber = React.memo(
}
};

const onUpButtonTouchStart = (event) => {
if (!props.disabled && !props.readOnly) {
repeat(event, null, 1);
}
};

const onUpButtonMouseDown = (event) => {
if (!props.disabled && !props.readOnly) {
props.autoFocus && DomHandler.focus(inputRef.current, props.autoFocus);
Expand All @@ -225,12 +219,6 @@ export const InputNumber = React.memo(
}
};

const onUpButtonTouchEnd = () => {
if (!props.disabled && !props.readOnly) {
clearTimer();
}
};

const onUpButtonMouseUp = () => {
if (!props.disabled && !props.readOnly) {
clearTimer();
Expand All @@ -255,18 +243,6 @@ export const InputNumber = React.memo(
}
};

const onDownButtonTouchStart = (event) => {
if (!props.disabled && !props.readOnly) {
repeat(event, null, -1);
}
};

const onDownButtonTouchEnd = () => {
if (!props.disabled && !props.readOnly) {
clearTimer();
}
};

const onDownButtonMouseDown = (event) => {
if (!props.disabled && !props.readOnly) {
props.autoFocus && DomHandler.focus(inputRef.current, props.autoFocus);
Expand Down Expand Up @@ -1059,13 +1035,11 @@ export const InputNumber = React.memo(
<button
type="button"
className={className}
onMouseLeave={onUpButtonMouseLeave}
onMouseDown={onUpButtonMouseDown}
onMouseUp={onUpButtonMouseUp}
onPointerLeave={onUpButtonMouseLeave}
onPointerDown={onUpButtonMouseDown}
onPointerUp={onUpButtonMouseUp}
onKeyDown={onUpButtonKeyDown}
onKeyUp={onUpButtonKeyUp}
onTouchStart={onUpButtonTouchStart}
onTouchEnd={onUpButtonTouchEnd}
disabled={props.disabled}
tabIndex={-1}
>
Expand All @@ -1089,13 +1063,11 @@ export const InputNumber = React.memo(
<button
type="button"
className={className}
onMouseLeave={onDownButtonMouseLeave}
onMouseDown={onDownButtonMouseDown}
onMouseUp={onDownButtonMouseUp}
onPointerLeave={onDownButtonMouseLeave}
onPointerDown={onDownButtonMouseDown}
onPointerUp={onDownButtonMouseUp}
onKeyDown={onDownButtonKeyDown}
onKeyUp={onDownButtonKeyUp}
onTouchStart={onDownButtonTouchStart}
onTouchEnd={onDownButtonTouchEnd}
disabled={props.disabled}
tabIndex={-1}
>
Expand Down

0 comments on commit 567f3e8

Please sign in to comment.