Skip to content

Commit d87b9d1

Browse files
fix: update
1 parent caa9ce8 commit d87b9d1

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

src/PickerInput/Selector/Input.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,29 @@ const Input = React.forwardRef<InputRef, InputProps>((props, ref) => {
227227
};
228228

229229
const onFormatKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
230-
// Block key input until selection is set (after mouseUp when focus was by mousedown)
231-
if (mouseDownRef.current) {
232-
event.preventDefault();
233-
return;
234-
}
235-
236230
onSharedKeyDown(event);
237231

238232
const { key } = event;
239233

234+
// Block mask editing until selection is set (after mouseUp when focus was by mousedown).
235+
// Still allow shared handlers (onKeyDown, Enter submit) above to run.
236+
if (mouseDownRef.current) {
237+
const shouldBlock =
238+
key.length === 1 ||
239+
key === 'Backspace' ||
240+
key === 'Delete' ||
241+
key === 'ArrowLeft' ||
242+
key === 'ArrowRight' ||
243+
key === 'ArrowUp' ||
244+
key === 'ArrowDown';
245+
246+
if (shouldBlock) {
247+
event.preventDefault();
248+
}
249+
250+
return;
251+
}
252+
240253
// Save the cache with cell text
241254
let nextCellText: string = null;
242255

0 commit comments

Comments
 (0)