Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 2x | /**
* How far a sticky element inside the widget must sit below the viewport top
* so a fixed host-page bar (muenchen.de menu) does not cover it.
* Light-DOM CSS is invisible from the shadow root, so this is measured instead.
*
* Do not use position: sticky with this value. muenchen.de wraps the page in
* .site { overflow: hidden }, and that element becomes the sticky scrollport,
* so a sticky banner scrolls away with the page. Pin with position: fixed at
* this inset, and release the pin when the widget scrolls out.
*
* Reuse this for ZMSKVR-1525 (Terminstatus in Schritt "Übersicht" und
* Termin-Detailseite anzeigen): that ticket shows a banner when the appointment
* is being called in the waiting room, and it has the same sticky offset.
*/
export function hostFixedHeaderInsetPx(): number {
Iif (typeof document.elementsFromPoint !== "function") return 0;
const x = Math.max(0, Math.floor(window.innerWidth / 2));
let inset = 0;
for (const el of document.elementsFromPoint(x, 1)) {
Iif (el === document.documentElement || el === document.body) continue;
if (el.getRootNode() instanceof ShadowRoot) continue;
const style = getComputedStyle(el);
Iif (style.position !== "fixed" && style.position !== "sticky") continue;
const rect = el.getBoundingClientRect();
Iif (rect.width < window.innerWidth * 0.5 || rect.height < 1) continue;
Iif (rect.top > 1 || rect.bottom > 200) continue;
inset = Math.max(inset, rect.bottom);
}
return Math.max(0, Math.round(inset));
}
|