Skip to content

Commit 8f89466

Browse files
committed
fix keyboard change
1 parent 00886f8 commit 8f89466

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/InputNumber/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,20 @@ export const InputNumber = forwardRef<InputNumberProps, 'input'>(
8787
onChange(v);
8888
}
8989
if (e.key === 'ArrowUp') {
90-
onChange(clamp((v ?? 0) + (e.shiftKey ? bigStep : step), { min, max }));
90+
const newValue = clamp((v ?? 0) + (e.shiftKey ? bigStep : step), {
91+
min,
92+
max,
93+
});
94+
setRawInput(String(newValue));
95+
onChange(newValue);
9196
}
9297
if (e.key === 'ArrowDown') {
93-
onChange(clamp((v ?? 0) - (e.shiftKey ? bigStep : step), { min, max }));
98+
const newValue = clamp((v ?? 0) - (e.shiftKey ? bigStep : step), {
99+
min,
100+
max,
101+
});
102+
onChange(newValue);
103+
setRawInput(String(newValue));
94104
}
95105
rest.onKeyDown?.(e);
96106
};

0 commit comments

Comments
 (0)