diff --git a/README.md b/README.md index b209cd1..305f8a3 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Property | Default | Accepted values | Description ## Options Option | Default | Accepted values | Description ----------- | -------- | --------------- | ----------- -`useKbEvents` | `false` | `boolean` | If true, the component will generate a `keypress` event and trigger it. If it returns with `false`, it won't insert the new character. +`useKbEvents` | `false` | `boolean` | If true, the component will generate a `keydown` event and trigger it. If it returns with `false`, it won't insert the new character. `preventClickEvent` | `false` | `boolean` | If true, the component will `preventDefault` the click event. ## Built-in layouts diff --git a/src/keyboard.vue b/src/keyboard.vue index ba99cd7..f77493b 100644 --- a/src/keyboard.vue +++ b/src/keyboard.vue @@ -235,7 +235,7 @@ if (this.input.maxLength <= 0 || text.length < this.input.maxLength) { if (this.options.useKbEvents) { let e = document.createEvent("Event"); - e.initEvent("keypress", true, true); + e.initEvent("keydown", true, true); e.which = e.keyCode = addChar.charCodeAt(); if (this.input.dispatchEvent(e)) { text = this.insertChar(caret, text, addChar);