Fixed #915 - Tooltip focus fails with some input components

pull/938/head
Cagatay Civici 2021-02-02 17:25:37 +03:00
parent a08b66db5a
commit 18f6307ab7
2 changed files with 20 additions and 12 deletions

View File

@ -820,7 +820,7 @@ export default {
}, },
computed: { computed: {
containerClass() { containerClass() {
return ['p-inputnumber p-component', this.class, { return ['p-inputnumber p-component p-inputwrapper', this.class, {
'p-inputwrapper-filled': this.filled, 'p-inputwrapper-filled': this.filled,
'p-inputwrapper-focus': this.focused, 'p-inputwrapper-focus': this.focused,
'p-inputnumber-buttons-stacked': this.showButtons && this.buttonLayout === 'stacked', 'p-inputnumber-buttons-stacked': this.showButtons && this.buttonLayout === 'stacked',

View File

@ -236,25 +236,33 @@ function isOutOfBounds(el) {
return (targetLeft + width > viewport.width) || (targetLeft < 0) || (targetTop < 0) || (targetTop + height > viewport.height); return (targetLeft + width > viewport.width) || (targetLeft < 0) || (targetTop < 0) || (targetTop + height > viewport.height);
} }
function getTarget(el) {
return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input'): el;
}
const Tooltip = { const Tooltip = {
beforeMount(el, options) { beforeMount(el, options) {
el.$_ptooltipModifiers = options.modifiers; let target = getTarget(el);
el.$_ptooltipValue = options.value; target.$_ptooltipModifiers = options.modifiers;
bindEvents(el); target.$_ptooltipValue = options.value;
bindEvents(target);
}, },
unmounted(el) { unmounted(el) {
remove(el); let target = getTarget(el);
unbindEvents(el); remove(target);
unbindEvents(target);
if (el.$_ptooltipScrollHandler) { if (target.$_ptooltipScrollHandler) {
el.$_ptooltipScrollHandler.destroy(); target.$_ptooltipScrollHandler.destroy();
el.$_ptooltipScrollHandler = null; target.$_ptooltipScrollHandler = null;
} }
}, },
updated(el, options) { updated(el, options) {
el.$_ptooltipModifiers = options.modifiers; let target = getTarget(el);
el.$_ptooltipValue = options.value; target.$_ptooltipModifiers = options.modifiers;
} target.$_ptooltipValue = options.value;
},
}; };
export default Tooltip; export default Tooltip;