Skip to content

Commit 14c9ab2

Browse files
authored
Clear timeout when pressing both increment and decrement button simultaneously in NumberField (#1582)
1 parent b8c1e53 commit 14c9ab2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/@react-aria/spinbutton/src/useSpinButton.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export function useSpinButton(
135135

136136
const onIncrementPressStart = useCallback(
137137
(initialStepDelay: number) => {
138+
clearAsync();
138139
onIncrement();
139140
// Start spinning after initial delay
140141
_async.current = window.setTimeout(
@@ -151,6 +152,7 @@ export function useSpinButton(
151152

152153
const onDecrementPressStart = useCallback(
153154
(initialStepDelay: number) => {
155+
clearAsync();
154156
onDecrement();
155157
// Start spinning after initial delay
156158
_async.current = window.setTimeout(

0 commit comments

Comments
 (0)