Skip to content

Commit

Permalink
Popover: show popper when InputNumber focused
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyang committed Aug 8, 2018
1 parent 9e738a8 commit bd25151
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions packages/popover/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bd25151

Please sign in to comment.