mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
Merge pull request #373 from adi518/master
Fix Dropdown closing abruptly when clicking scrollbar under IE
This commit is contained in:
@@ -5,6 +5,7 @@ npm-debug.log
|
|||||||
test/unit/coverage
|
test/unit/coverage
|
||||||
.coveralls.yml
|
.coveralls.yml
|
||||||
.flowconfig
|
.flowconfig
|
||||||
|
package-lock.json
|
||||||
docs/gitbook/_book
|
docs/gitbook/_book
|
||||||
docs/node_modules
|
docs/node_modules
|
||||||
site
|
site
|
||||||
@@ -377,9 +377,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<transition :name="transition">
|
<transition :name="transition">
|
||||||
<ul ref="dropdownMenu" v-if="dropdownOpen" class="dropdown-menu" :style="{ 'max-height': maxHeight }" role="listbox">
|
<ul ref="dropdownMenu" v-if="dropdownOpen" class="dropdown-menu" :style="{ 'max-height': maxHeight }" role="listbox" @mousedown="onMousedown">
|
||||||
<li role="option" v-for="(option, index) in filteredOptions" v-bind:key="index" :class="{ active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover="typeAheadPointer = index">
|
<li role="option" v-for="(option, index) in filteredOptions" v-bind:key="index" :class="{ active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover="typeAheadPointer = index">
|
||||||
<a @mousedown.prevent="select(option)">
|
<a @mousedown.prevent.stop="select(option)">
|
||||||
<slot name="option" v-bind="(typeof option === 'object')?option:{[label]: option}">
|
<slot name="option" v-bind="(typeof option === 'object')?option:{[label]: option}">
|
||||||
{{ getOptionLabel(option) }}
|
{{ getOptionLabel(option) }}
|
||||||
</slot>
|
</slot>
|
||||||
@@ -977,11 +977,15 @@
|
|||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
onSearchBlur() {
|
onSearchBlur() {
|
||||||
if (this.clearSearchOnBlur) {
|
if (this.mousedown && !this.searching) {
|
||||||
this.search = ''
|
this.mousedown = false
|
||||||
|
} else {
|
||||||
|
if (this.clearSearchOnBlur) {
|
||||||
|
this.search = ''
|
||||||
|
}
|
||||||
|
this.open = false
|
||||||
|
this.$emit('search:blur')
|
||||||
}
|
}
|
||||||
this.open = false
|
|
||||||
this.$emit('search:blur')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1037,6 +1041,17 @@
|
|||||||
if (this.pushTags) {
|
if (this.pushTags) {
|
||||||
this.mutableOptions.push(option)
|
this.mutableOptions.push(option)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event-Handler to help workaround IE11 (probably fixes 10 as well)
|
||||||
|
* firing a `blur` event when clicking
|
||||||
|
* the dropdown's scrollbar, causing it
|
||||||
|
* to collapse abruptly.
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
onMousedown() {
|
||||||
|
this.mousedown = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user