Skip to content

Commit 9c5b7e5

Browse files
authored
Popover: show popper when InputNumber focused (#12284)
1 parent 3da485b commit 9c5b7e5

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

packages/popover/src/main.vue

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,7 @@ export default {
113113
on(reference, 'mouseleave', this.handleMouseLeave);
114114
on(popper, 'mouseleave', this.handleMouseLeave);
115115
} else if (this.trigger === 'focus') {
116-
let found = false;
117-
118-
if ([].slice.call(reference.children).length) {
119-
const children = reference.childNodes;
120-
const len = children.length;
121-
for (let i = 0; i < len; i++) {
122-
if (children[i].nodeName === 'INPUT' ||
123-
children[i].nodeName === 'TEXTAREA') {
124-
on(children[i], 'focusin', this.doShow);
125-
on(children[i], 'focusout', this.doClose);
126-
found = true;
127-
break;
128-
}
129-
}
130-
}
131-
if (found) return;
132-
if (reference.nodeName === 'INPUT' ||
133-
reference.nodeName === 'TEXTAREA') {
116+
if (reference.querySelector('input, textarea')) {
134117
on(reference, 'focusin', this.doShow);
135118
on(reference, 'focusout', this.doClose);
136119
} else {
@@ -214,6 +197,8 @@ export default {
214197
off(reference, 'mousedown', this.doShow);
215198
off(reference, 'focusin', this.doShow);
216199
off(reference, 'focusout', this.doClose);
200+
off(reference, 'mousedown', this.doShow);
201+
off(reference, 'mouseup', this.doClose);
217202
off(reference, 'mouseleave', this.handleMouseLeave);
218203
off(reference, 'mouseenter', this.handleMouseEnter);
219204
off(document, 'click', this.handleDocumentClick);

0 commit comments

Comments
 (0)