Skip to content

Commit

Permalink
fix: added event cancelable to touch event
Browse files Browse the repository at this point in the history
  • Loading branch information
severinlandolt committed Oct 31, 2023
1 parent cf9c78a commit 5154644
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/input-elements/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>((props,
tabIndex={-1}
onClick={(e) => e.preventDefault()}
onMouseDown={(e) => e.preventDefault()}
onTouchStart={(e) => e.preventDefault()}
onTouchStart={(e) => {
if (e.cancelable) {
e.preventDefault();
}
}}
onMouseUp={() => {
if (disabled) return;
inputRef.current?.stepDown();
Expand All @@ -100,7 +104,11 @@ const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>((props,
tabIndex={-1}
onClick={(e) => e.preventDefault()}
onMouseDown={(e) => e.preventDefault()}
onTouchStart={(e) => e.preventDefault()}
onTouchStart={(e) => {
if (e.cancelable) {
e.preventDefault();
}
}}
onMouseUp={() => {
if (disabled) return;
inputRef.current?.stepUp();
Expand Down

0 comments on commit 5154644

Please sign in to comment.