fix(tooltip): support reconnecting tooltip arrow inside other overlays
This commit is contained in:
parent
afd5ac96cc
commit
78a8554019
1 changed files with 4 additions and 7 deletions
|
|
@ -12,12 +12,9 @@ export class LionTooltip extends OverlayMixin(LitElement) {
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
this._overlayContentNode.setAttribute('role', 'tooltip');
|
this._overlayContentNode.setAttribute('role', 'tooltip');
|
||||||
}
|
// Schedule setting up the arrow element so that it works both on firstUpdated
|
||||||
|
// and when the tooltip is moved in the DOM (disconnected + reconnected)
|
||||||
firstUpdated(...args) {
|
this.updateComplete.then(() => this.__setupArrowElement());
|
||||||
super.firstUpdated(...args);
|
|
||||||
|
|
||||||
this.__setupArrowElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
@ -30,7 +27,7 @@ export class LionTooltip extends OverlayMixin(LitElement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__setupArrowElement() {
|
__setupArrowElement() {
|
||||||
this.__arrowElement = this.querySelector('[slot=arrow]');
|
this.__arrowElement = Array.from(this.children).find(child => child.slot === 'arrow');
|
||||||
if (!this.__arrowElement) {
|
if (!this.__arrowElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue