Close dropdown for single select boxes without search on blur

This commit is contained in:
Josh Johnson 2016-08-08 13:32:29 +01:00
parent 01c735afa7
commit 97451458ae
2 changed files with 5 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -1223,8 +1223,9 @@ export class Choices {
// Remove the focus state
this.containerOuter.classList.remove(this.config.classNames.focusState);
// Close the dropdown if there is one
if(hasActiveDropdown && e.target === this.input) {
// Close the dropdown if it is active, the input is the target (select-multiple, text, select-one (with search))
// or the outer container is the target with no search (select-one)
if(hasActiveDropdown && (e.target === this.input || e.target === this.containerOuter && !this.canSearch)) {
this.hideDropdown();
}
}