Skip to content

Commit de01b41

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat-1.4.0
2 parents b2e9baa + 6dd61cd commit de01b41

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

components/_util/env.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
// Browser environment sniffing
12
export const inBrowser = typeof window !== 'undefined';
3+
export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
4+
export const weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
25
export const UA = inBrowser && window.navigator.userAgent.toLowerCase();
36
export const isIE = UA && /msie|trident/.test(UA);
47
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0;
8+
export const isEdge = UA && UA.indexOf('edge/') > 0;
9+
export const isAndroid = (UA && UA.indexOf('android') > 0) || weexPlatform === 'android';
10+
export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || weexPlatform === 'ios';
11+
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
12+
export const isPhantomJS = UA && /phantomjs/.test(UA);
13+
export const isFF = UA && UA.match(/firefox\/(\d+)/);

components/vc-select/Select.jsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
} from './util';
5252
import { SelectPropTypes } from './PropTypes';
5353
import contains from '../_util/Dom/contains';
54+
import { isIE, isEdge } from '../_util/env';
5455

5556
Vue.use(ref, { name: 'ant-ref' });
5657
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
@@ -463,6 +464,7 @@ const Select = {
463464
onArrowClick(e) {
464465
e.stopPropagation();
465466
e.preventDefault();
467+
this.clearBlurTime();
466468
if (!this.disabled) {
467469
this.setOpenState(!this.$data._open, !this.$data._open);
468470
}
@@ -640,12 +642,17 @@ const Select = {
640642
},
641643
inputBlur(e) {
642644
const target = e.relatedTarget || document.activeElement;
645+
646+
// https://github.com/vueComponent/ant-design-vue/issues/999
647+
// https://github.com/vueComponent/ant-design-vue/issues/1223
643648
if (
644-
(target &&
645-
this.selectTriggerRef &&
646-
this.selectTriggerRef.getInnerMenu() &&
647-
this.selectTriggerRef.getInnerMenu().$el === target) ||
648-
contains(e.target, target)
649+
(isIE || isEdge) &&
650+
(e.relatedTarget === this.$refs.arrow ||
651+
(target &&
652+
this.selectTriggerRef &&
653+
this.selectTriggerRef.getInnerMenu() &&
654+
this.selectTriggerRef.getInnerMenu().$el === target) ||
655+
contains(e.target, target))
649656
) {
650657
e.target.focus();
651658
e.preventDefault();
@@ -701,7 +708,7 @@ const Select = {
701708
}
702709
this.setOpenState(false);
703710
this.$emit('blur', this.getVLForOnChange(value));
704-
}, 10);
711+
}, 200);
705712
},
706713
inputFocus(e) {
707714
if (this.$props.disabled) {
@@ -1434,6 +1441,7 @@ const Select = {
14341441
style={UNSELECTABLE_STYLE}
14351442
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
14361443
onClick={this.onArrowClick}
1444+
ref="arrow"
14371445
>
14381446
{inputIcon || defaultIcon}
14391447
</span>

components/vc-trigger/Trigger.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default {
237237
},
238238

239239
onBlur(e) {
240-
if (!contains(e.target, e.relatedTarget)) {
240+
if (!contains(e.target, e.relatedTarget || document.activeElement)) {
241241
this.fireEvents('blur', e);
242242
this.clearDelayTimer();
243243
if (this.isBlurToHide()) {

0 commit comments

Comments
 (0)