Skip to content

Commit f768123

Browse files
[FIX] if input is embed into form, keydown must be catched to stop form sent
1 parent 6b0861e commit f768123

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/autocomplete.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @license MIT
33
*
4-
* Autocomplete.js v2.6.1
4+
* Autocomplete.js v2.6.2
55
* Developed by Baptiste Donaux
66
* http://autocomplete-js.com
77
*
@@ -131,8 +131,10 @@ class AutoComplete {
131131
Is: 13,
132132
Not: false
133133
}],
134-
Callback: function() {
134+
Callback: function(event) {
135135
if (this.DOMResults.getAttribute("class").indexOf("open") != -1) {
136+
event.preventDefault();
137+
136138
var liActive = this.DOMResults.querySelector("li.active");
137139

138140
if (liActive !== null) {
@@ -142,7 +144,7 @@ class AutoComplete {
142144
}
143145
},
144146
Operator: ConditionOperator.AND,
145-
Event: EventType.KEYUP
147+
Event: EventType.KEYDOWN
146148
},
147149
"KeyUpAndDown_down": {
148150
Conditions: [{

0 commit comments

Comments
 (0)