Skip to content

Commit 522f084

Browse files
committed
number keyboard keys basic.
1 parent a5622f5 commit 522f084

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/components/pg/inputNumber/inputNumber.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export default class PgInputNumber extends HTMLElement {
2626
connectedCallback() {
2727
this.$input.addEventListener('input', this.handleInput.bind(this));
2828
this.$input.addEventListener('change', this.handleChange.bind(this));
29+
this.$input.addEventListener('beforeinput', (e: KeyboardEvent) => {
30+
switch (e.key) {
31+
case 'ArrowUp':
32+
this.#triggerInput(this.value + this.step);
33+
break;
34+
case 'ArrowDown':
35+
this.#triggerInput(this.value - this.step);
36+
break;
37+
}
38+
});
2939
this.$buttonMinus.addEventListener('increment', (e: any) => {
3040
this.#triggerInput(this.value - this.step);
3141
});

0 commit comments

Comments
 (0)