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: {
containerClass() {
return ['p-inputnumber p-component', this.class, {
return ['p-inputnumber p-component p-inputwrapper', this.class, {
'p-inputwrapper-filled': this.filled,
'p-inputwrapper-focus': this.focused,
'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);
}
function getTarget(el) {
return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input'): el;
}
const Tooltip = {
beforeMount(el, options) {
el.$_ptooltipModifiers = options.modifiers;
el.$_ptooltipValue = options.value;
bindEvents(el);
let target = getTarget(el);
target.$_ptooltipModifiers = options.modifiers;
target.$_ptooltipValue = options.value;
bindEvents(target);
},
unmounted(el) {
remove(el);
unbindEvents(el);
let target = getTarget(el);
remove(target);
unbindEvents(target);
if (el.$_ptooltipScrollHandler) {
el.$_ptooltipScrollHandler.destroy();
el.$_ptooltipScrollHandler = null;
if (target.$_ptooltipScrollHandler) {
target.$_ptooltipScrollHandler.destroy();
target.$_ptooltipScrollHandler = null;
}
},
updated(el, options) {
el.$_ptooltipModifiers = options.modifiers;
el.$_ptooltipValue = options.value;
}
let target = getTarget(el);
target.$_ptooltipModifiers = options.modifiers;
target.$_ptooltipValue = options.value;
},
};
export default Tooltip;