Skip to content

Commit 9d9b939

Browse files
authored
Merge pull request sagalbot#373 from adi518/master
Fix Dropdown closing abruptly when clicking scrollbar under IE
2 parents 70c3129 + da5c6ba commit 9d9b939

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ npm-debug.log
55
test/unit/coverage
66
.coveralls.yml
77
.flowconfig
8+
package-lock.json
89
docs/gitbook/_book
910
docs/node_modules
1011
site

src/components/Select.vue

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@
377377
</div>
378378

379379
<transition :name="transition">
380-
<ul ref="dropdownMenu" v-if="dropdownOpen" class="dropdown-menu" :style="{ 'max-height': maxHeight }" role="listbox">
380+
<ul ref="dropdownMenu" v-if="dropdownOpen" class="dropdown-menu" :style="{ 'max-height': maxHeight }" role="listbox" @mousedown="onMousedown">
381381
<li role="option" v-for="(option, index) in filteredOptions" v-bind:key="index" :class="{ active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover="typeAheadPointer = index">
382-
<a @mousedown.prevent="select(option)">
382+
<a @mousedown.prevent.stop="select(option)">
383383
<slot name="option" v-bind="(typeof option === 'object')?option:{[label]: option}">
384384
{{ getOptionLabel(option) }}
385385
</slot>
@@ -977,11 +977,15 @@
977977
* @return {void}
978978
*/
979979
onSearchBlur() {
980-
if (this.clearSearchOnBlur) {
981-
this.search = ''
980+
if (this.mousedown && !this.searching) {
981+
this.mousedown = false
982+
} else {
983+
if (this.clearSearchOnBlur) {
984+
this.search = ''
985+
}
986+
this.open = false
987+
this.$emit('search:blur')
982988
}
983-
this.open = false
984-
this.$emit('search:blur')
985989
},
986990
987991
/**
@@ -1037,6 +1041,17 @@
10371041
if (this.pushTags) {
10381042
this.mutableOptions.push(option)
10391043
}
1044+
},
1045+
1046+
/**
1047+
* Event-Handler to help workaround IE11 (probably fixes 10 as well)
1048+
* firing a `blur` event when clicking
1049+
* the dropdown's scrollbar, causing it
1050+
* to collapse abruptly.
1051+
* @return {void}
1052+
*/
1053+
onMousedown() {
1054+
this.mousedown = true
10401055
}
10411056
},
10421057

0 commit comments

Comments
 (0)