Skip to content

Fix: take the mobile safe area from CSS, not a one-time read - #66

Merged
SandObserver merged 2 commits into
mainfrom
fix/mobile-safe-area-from-css
Aug 14, 2026
Merged

SandObserver merged 2 commits into
mainfrom
fix/mobile-safe-area-from-css

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Define --sa-top / --sa-bottom in dashboard.css as max(env(safe-area-inset-*), scaled minimum) and reserve them in .mob-page padding, so the browser keeps the insets current.
  • Replace the per-page inline grid with .mob-page / .mob-grid / .mob-cell classes; rows are repeat(6,1fr) instead of a JavaScript pixel height.
  • Size the mobile layout from the measured grid box (getBoundingClientRect) instead of viewport - insets - reserves, and delete readSafeInsets.
  • Drop the inset parameters, sb, safe, avail, rh and cw from mobileMetrics; pillBottom and contentBottom are now distances above the CSS-reserved bottom.
  • Anchor the dock and the search pill to var(--sa-bottom).
  • Observe a .sa-probe element sized by the insets with a ResizeObserver and rebuild the mobile layout when its box changes, skipping the initial observation.
  • Add the missing top inset to the mobile Settings layout.

Testing
All green, except the Docker build smoke test, which has no local Docker and is left to CI. Rewrote mobile-metrics.test.mjs around the new contract and added 9 tests covering the CSS-owned insets, the measured grid box, the dock and pill anchors, the rebuild trigger, and the Settings inset.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

@SandObserver SandObserver added bug Something isn't working ui/ux UI, UX, and accessibility only fix labels Aug 14, 2026
iOS reports its safe-area insets after the first paint and again after a
rotation. The mobile layout read them once during boot, got zero, and
built the phone home screen against an 18px fallback, so the first row
sat under the status bar. The mobile resize path ignored the event that
carried the real value.

The insets now live in the stylesheet, the layout measures the box the
stylesheet produced, and a probe sized by the insets drives a rebuild
when they change. Settings gains the top inset it never had.
@SandObserver
SandObserver force-pushed the fix/mobile-safe-area-from-css branch from cfaedd1 to e254edc Compare August 14, 2026 20:46
@SandObserver
SandObserver merged commit 81d1aad into main Aug 14, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/mobile-safe-area-from-css branch August 14, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ui/ux UI, UX, and accessibility only fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant