fix(overlays): fix overlay content node selector to be more accurate
This commit is contained in:
parent
57a3c04873
commit
411889c919
2 changed files with 14 additions and 10 deletions
|
|
@ -148,11 +148,21 @@ export const OverlayMixin = dedupeMixin(
|
||||||
return Array.from(this.children).find(child => child.slot === 'invoker');
|
return Array.from(this.children).find(child => child.slot === 'invoker');
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This should be refactored to
|
|
||||||
// Array.from(this.children).find(child => child.slot === 'content')
|
|
||||||
// When this issue is fixed https://github.com/ing-bank/lion/issues/382
|
|
||||||
get _overlayContentNode() {
|
get _overlayContentNode() {
|
||||||
const contentNode = this.querySelector('[slot=content]');
|
let contentNode;
|
||||||
|
|
||||||
|
// FIXME: This should shadow outlet in between the host and the content slot, is a problem
|
||||||
|
// Should simply be Array.from(this.children).find(child => child.slot === 'content')
|
||||||
|
// Issue: https://github.com/ing-bank/lion/issues/382
|
||||||
|
const shadowOutlet = Array.from(this.children).find(
|
||||||
|
child => child.slot === '_overlay-shadow-outlet',
|
||||||
|
);
|
||||||
|
if (shadowOutlet) {
|
||||||
|
contentNode = Array.from(shadowOutlet.children).find(child => child.slot === 'content');
|
||||||
|
} else {
|
||||||
|
contentNode = Array.from(this.children).find(child => child.slot === 'content');
|
||||||
|
}
|
||||||
|
|
||||||
if (contentNode) {
|
if (contentNode) {
|
||||||
this._cachedOverlayContentNode = contentNode;
|
this._cachedOverlayContentNode = contentNode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,12 +84,6 @@ const overlayDemoStyle = css`
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
.overlay {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
customElements.define(
|
customElements.define(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue