keyboard event update

pull/2809/head
Tuğçe Küçükoğlu 2022-07-27 12:52:36 +03:00
parent 0cae7b2e84
commit 0cd90da5f4
1 changed files with 11 additions and 15 deletions

View File

@ -183,41 +183,37 @@ export default {
}, },
onKeyDown(event, index) { onKeyDown(event, index) {
this.handleIndex = index; this.handleIndex = index;
switch (event.which) { switch (event.code) {
//down and left case 'ArrowDown':
case 40: case 'ArrowLeft':
case 37:
this.decrementValue(event, index); this.decrementValue(event, index);
event.preventDefault(); event.preventDefault();
break; break;
//up and right case 'ArrowUp':
case 38: case 'ArrowRight':
case 39:
this.incrementValue(event, index); this.incrementValue(event, index);
event.preventDefault(); event.preventDefault();
break; break;
//page down case 'PageDown':
case 34:
this.decrementValue(event, index, true); this.decrementValue(event, index, true);
event.preventDefault(); event.preventDefault();
break; break;
//page up case 'PageUp':
case 33:
this.incrementValue(event, index, true); this.incrementValue(event, index, true);
event.preventDefault(); event.preventDefault();
break; break;
//home case 'Home':
case 36:
this.updateModel(event, this.min); this.updateModel(event, this.min);
event.preventDefault();
break; break;
//end case 'End':
case 35:
this.updateModel(event, this.max); this.updateModel(event, this.max);
event.preventDefault();
break; break;
default: default: