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:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user