Popover: show popper when InputNumber focused (#12284)

pull/12304/head
hetech 2018-08-08 18:41:53 +08:00 committed by GitHub
parent 3da485b617
commit 9c5b7e5fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 18 deletions

View File

@ -113,24 +113,7 @@ export default {
on(reference, 'mouseleave', this.handleMouseLeave);
on(popper, 'mouseleave', this.handleMouseLeave);
} else if (this.trigger === 'focus') {
let found = false;
if ([].slice.call(reference.children).length) {
const children = reference.childNodes;
const len = children.length;
for (let i = 0; i < len; i++) {
if (children[i].nodeName === 'INPUT' ||
children[i].nodeName === 'TEXTAREA') {
on(children[i], 'focusin', this.doShow);
on(children[i], 'focusout', this.doClose);
found = true;
break;
}
}
}
if (found) return;
if (reference.nodeName === 'INPUT' ||
reference.nodeName === 'TEXTAREA') {
if (reference.querySelector('input, textarea')) {
on(reference, 'focusin', this.doShow);
on(reference, 'focusout', this.doClose);
} else {
@ -214,6 +197,8 @@ export default {
off(reference, 'mousedown', this.doShow);
off(reference, 'focusin', this.doShow);
off(reference, 'focusout', this.doClose);
off(reference, 'mousedown', this.doShow);
off(reference, 'mouseup', this.doClose);
off(reference, 'mouseleave', this.handleMouseLeave);
off(reference, 'mouseenter', this.handleMouseEnter);
off(document, 'click', this.handleDocumentClick);