2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

ensure open-indicator can open the dropdown

This commit is contained in:
Jeff
2019-04-14 09:35:16 -05:00
parent 9c2cafec7a
commit 79882ed2ac
+15 -6
View File
@@ -547,15 +547,24 @@
* @param {Event} e * @param {Event} e
* @return {void} * @return {void}
*/ */
toggleDropdown(e) { toggleDropdown (e) {
if (e.target === this.$refs.openIndicator || e.target === this.searchEl || e.target === this.$refs.toggle || const toggleTargets = [
e.target.classList.contains('vs__selected') || e.target === this.$el) { this.$el,
this.searchEl,
this.$refs.toggle.$el,
this.$refs.openIndicator.$el,
...Array.from(this.$refs.openIndicator.$el.children),
];
const target = e.target;
if (toggleTargets.includes(target) || target.classList.contains('vs__selected')) {
if (this.open) { if (this.open) {
this.searchEl.blur() // dropdown will close on blur this.searchEl.blur(); // dropdown will close on blur
} else { } else {
if (!this.disabled) { if (!this.disabled) {
this.open = true this.open = true;
this.searchEl.focus() this.searchEl.focus();
} }
} }
} }