Skip to content

Commit 122e5ef

Browse files
committed
Workaround for the focus problem (bug #453)
1 parent 9c16639 commit 122e5ef

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

dist/cjs.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ function _await(value, then, direct) {
6262
return result.then(then);
6363
}return then(result);
6464
}function _invokeIgnored(body) {
65-
var result = body();
66-
if (result && result.then) {
65+
var result = body();if (result && result.then) {
6766
return result.then(_empty);
6867
}
6968
}function _catch(body, recover) {
@@ -75,8 +74,8 @@ function _await(value, then, direct) {
7574
return result.then(void 0, recover);
7675
}return result;
7776
}function _finally(body, finalizer) {
78-
7977
try {
78+
8079
var result = body();
8180
} catch (e) {
8281
return finalizer();
@@ -554,7 +553,7 @@ function _await(value, then, direct) {
554553
this.isFalseFocus = true;
555554
setTimeout(function () {
556555
_this8.inputElement.focus();
557-
}, 0);
556+
}, 200);
558557
}
559558
} else {
560559
this.inputElement.blur();
@@ -574,9 +573,7 @@ function _await(value, then, direct) {
574573
// Show list only if the item has not been clicked (isFalseFocus indicates that click was made earlier)
575574
if (!this.isClicking && !this.isFalseFocus) {
576575
this.showSuggestions();
577-
}
578-
579-
this.isFalseFocus = false;
576+
}this.isFalseFocus = false;
580577
},
581578
onInput: function onInput(inputEvent) {
582579
var value = !inputEvent.target ? inputEvent : inputEvent.target.value;
@@ -595,7 +592,9 @@ function _await(value, then, direct) {
595592
if (this.text.length < this.minLength) {
596593
this.hideList();
597594
return;
598-
}if (this.debounce) {
595+
}
596+
597+
if (this.debounce) {
599598
clearTimeout(this.timeoutInstance);
600599
this.timeoutInstance = setTimeout(this.research, this.debounce);
601600
} else {

dist/es6.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ function _await(value, then, direct) {
5656
return result.then(then);
5757
}return then(result);
5858
}function _invokeIgnored(body) {
59-
var result = body();
60-
if (result && result.then) {
59+
var result = body();if (result && result.then) {
6160
return result.then(_empty);
6261
}
6362
}function _catch(body, recover) {
@@ -69,8 +68,8 @@ function _await(value, then, direct) {
6968
return result.then(void 0, recover);
7069
}return result;
7170
}function _finally(body, finalizer) {
72-
7371
try {
72+
7473
var result = body();
7574
} catch (e) {
7675
return finalizer();
@@ -518,7 +517,7 @@ function _await(value, then, direct) {
518517
this.isFalseFocus = true;
519518
setTimeout(() => {
520519
this.inputElement.focus();
521-
}, 0);
520+
}, 200);
522521
}
523522
} else {
524523
this.inputElement.blur();
@@ -543,9 +542,7 @@ function _await(value, then, direct) {
543542
// Show list only if the item has not been clicked (isFalseFocus indicates that click was made earlier)
544543
if (!this.isClicking && !this.isFalseFocus) {
545544
this.showSuggestions();
546-
}
547-
548-
this.isFalseFocus = false;
545+
}this.isFalseFocus = false;
549546
},
550547
onInput(inputEvent) {
551548
const value = !inputEvent.target ? inputEvent : inputEvent.target.value;
@@ -564,7 +561,9 @@ function _await(value, then, direct) {
564561
if (this.text.length < this.minLength) {
565562
this.hideList();
566563
return;
567-
}if (this.debounce) {
564+
}
565+
566+
if (this.debounce) {
568567
clearTimeout(this.timeoutInstance);
569568
this.timeoutInstance = setTimeout(this.research, this.debounce);
570569
} else {

dist/es7.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ var VueSimpleSuggest = {
462462
this.isFalseFocus = true;
463463
setTimeout(() => {
464464
this.inputElement.focus();
465-
}, 0);
465+
}, 200);
466466
}
467467
} else {
468468
this.inputElement.blur();

dist/iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/vue-simple-suggest.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export default {
486486
this.isFalseFocus = true
487487
setTimeout(() => {
488488
this.inputElement.focus()
489-
}, 0)
489+
}, 200)
490490
}
491491
} else {
492492
this.inputElement.blur()

0 commit comments

Comments
 (0)