Skip to content

Commit 8b0cd2e

Browse files
authored
Merge pull request #18 from yonmey/fix-keypress-event-to-keydown
Fix - keypress event to keydown changed
2 parents c750ddb + 83e3f35 commit 8b0cd2e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Property | Default | Accepted values | Description
9797
## Options
9898
Option | Default | Accepted values | Description
9999
----------- | -------- | --------------- | -----------
100-
`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.
100+
`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.
101101
`preventClickEvent` | `false` | `boolean` | If true, the component will `preventDefault` the click event.
102102

103103
## Built-in layouts

src/keyboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
if (this.input.maxLength <= 0 || text.length < this.input.maxLength) {
236236
if (this.options.useKbEvents) {
237237
let e = document.createEvent("Event");
238-
e.initEvent("keypress", true, true);
238+
e.initEvent("keydown", true, true);
239239
e.which = e.keyCode = addChar.charCodeAt();
240240
if (this.input.dispatchEvent(e)) {
241241
text = this.insertChar(caret, text, addChar);

0 commit comments

Comments
 (0)