Skip to content

Commit fd12854

Browse files
committed
fix(dateinput): Check keystroke before parsing typed date
1 parent 11198cb commit fd12854

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/components/DateInput.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@keydown.enter.prevent="handleKeydownEnter"
4949
@keydown.esc.prevent="clearDate"
5050
@keydown.space="handleKeydownSpace($event)"
51-
@keyup="handleKeyup"
51+
@keyup="handleKeyup($event)"
5252
@keyup.space="handleKeyupSpace($event)"
5353
/>
5454
<!-- Clear Button -->
@@ -274,8 +274,22 @@ export default {
274274
},
275275
/**
276276
* Parses a typed date and submits it, if valid
277+
* @param {object} event Used to exclude certain keystrokes
277278
*/
278-
handleKeyup() {
279+
handleKeyup(event) {
280+
if (
281+
[
282+
'Shift',
283+
'Tab',
284+
'ArrowUp',
285+
'ArrowDown',
286+
'ArrowLeft',
287+
'ArrowRight',
288+
].includes(event.key)
289+
) {
290+
return
291+
}
292+
279293
if (this.input.value === '') {
280294
this.$emit('typed-date', null)
281295
return

0 commit comments

Comments
 (0)