@fasl-work/caos-app-shell 0.19.1 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/gate/inpage.mjs +13 -2
  2. package/package.json +1 -1
package/gate/inpage.mjs CHANGED
@@ -890,7 +890,7 @@ export function installLib() {
890
890
  }
891
891
  // the document is scrolled so the element shows below a header stuck at the top of the viewport (0.8.0: the
892
892
  // sticky header sticks in a scrolling document since known shell defect 26 was fixed)
893
- const cover = el.closest('header, [role="banner"]') ? 0 : stuckTop();
893
+ const cover = coverFor(el);
894
894
  const r = el.getBoundingClientRect();
895
895
  if (r.top < cover || r.bottom > window.innerHeight) winScroll(window.scrollX, window.scrollY + r.top + r.height / 2 - (cover + (window.innerHeight - cover) / 2));
896
896
  const r2 = el.getBoundingClientRect();
@@ -918,8 +918,19 @@ export function installLib() {
918
918
  return bottom;
919
919
  }
920
920
 
921
+ /** A link inside a static section <header> is still covered by the sticky site header above it. */
922
+ function coverFor(el) {
923
+ const header = el.closest('header, [role="banner"]');
924
+ if (header) {
925
+ const style = getComputedStyle(header);
926
+ const rect = header.getBoundingClientRect();
927
+ if ((style.position === 'sticky' || style.position === 'fixed') && rect.top <= 1 && rect.bottom > 0) return 0;
928
+ }
929
+ return stuckTop();
930
+ }
931
+
921
932
  const visibleArea = (el) => {
922
- const area = { left: 0, top: el.closest('header, [role="banner"]') ? 0 : stuckTop(), right: window.innerWidth, bottom: window.innerHeight };
933
+ const area = { left: 0, top: coverFor(el), right: window.innerWidth, bottom: window.innerHeight };
923
934
  for (let a = el.parentElement; a && a !== document.body && a !== document.documentElement; a = a.parentElement) {
924
935
  const s = getComputedStyle(a);
925
936
  if (s.overflowX === 'visible' && s.overflowY === 'visible') continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fasl-work/caos-app-shell",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Shared web-app shell, workbench primitives, content primitives, design system and measured gate for the CAOS / Faena public apps (ADR-0016, ADR-0017, ADR-0071).",
5
5
  "license": "MIT",
6
6
  "author": "Felipe Santibáñez-Leal",