Commit 5f75ab83 authored by 落叶's avatar 落叶 Committed by 杨奕

Select: focusing does not show popper (#9894)

parent 95d2eabd
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<div <div
class="el-select" class="el-select"
:class="[selectSize ? 'el-select--' + selectSize : '']" :class="[selectSize ? 'el-select--' + selectSize : '']"
@click.stop="toggleMenu"
v-clickoutside="handleClose"> v-clickoutside="handleClose">
<div <div
class="el-select__tags" class="el-select__tags"
v-if="multiple" v-if="multiple"
@click.stop="toggleMenu"
ref="tags" ref="tags"
:style="{ 'max-width': inputWidth - 32 + 'px' }"> :style="{ 'max-width': inputWidth - 32 + 'px' }">
<span v-if="collapseTags && selected.length"> <span v-if="collapseTags && selected.length">
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
:class="{ 'is-focus': visible }" :class="{ 'is-focus': visible }"
@focus="handleFocus" @focus="handleFocus"
@blur="handleBlur" @blur="handleBlur"
@mousedown.native="handleMouseDown"
@keyup.native="debouncedOnInputChange" @keyup.native="debouncedOnInputChange"
@keydown.native.down.stop.prevent="navigateOptions('next')" @keydown.native.down.stop.prevent="navigateOptions('next')"
@keydown.native.up.stop.prevent="navigateOptions('prev')" @keydown.native.up.stop.prevent="navigateOptions('prev')"
...@@ -520,7 +519,6 @@ ...@@ -520,7 +519,6 @@
}, },
handleFocus(event) { handleFocus(event) {
this.visible = true;
this.$emit('focus', event); this.$emit('focus', event);
}, },
...@@ -531,16 +529,6 @@ ...@@ -531,16 +529,6 @@
handleIconClick(event) { handleIconClick(event) {
if (this.iconClass.indexOf('circle-close') > -1) { if (this.iconClass.indexOf('circle-close') > -1) {
this.deleteSelected(event); this.deleteSelected(event);
} else {
this.toggleMenu();
}
},
handleMouseDown(event) {
if (event.target.tagName !== 'INPUT') return;
if (this.visible) {
this.handleClose();
event.preventDefault();
} }
}, },
...@@ -674,9 +662,13 @@ ...@@ -674,9 +662,13 @@
}, },
selectOption() { selectOption() {
if (!this.visible) {
this.toggleMenu();
} else {
if (this.options[this.hoverIndex]) { if (this.options[this.hoverIndex]) {
this.handleOptionSelect(this.options[this.hoverIndex]); this.handleOptionSelect(this.options[this.hoverIndex]);
} }
}
}, },
deleteSelected(event) { deleteSelected(event) {
......
...@@ -440,7 +440,7 @@ describe('Select', () => { ...@@ -440,7 +440,7 @@ describe('Select', () => {
}; };
vm = getSelectVm({ filterable: true, filterMethod }); vm = getSelectVm({ filterable: true, filterMethod });
const select = vm.$children[0]; const select = vm.$children[0];
select.$el.querySelector('input').focus(); select.$el.click();
setTimeout(() => { setTimeout(() => {
select.selectedLabel = ''; select.selectedLabel = '';
select.onInputChange(); select.onInputChange();
...@@ -479,7 +479,7 @@ describe('Select', () => { ...@@ -479,7 +479,7 @@ describe('Select', () => {
const select = vm.$children[0]; const select = vm.$children[0];
setTimeout(() => { setTimeout(() => {
select.$el.querySelector('input').focus(); select.$el.click();
select.query = '3'; select.query = '3';
select.handleQueryChange('3'); select.handleQueryChange('3');
select.selectOption(); select.selectOption();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment