Skip to content

Expand DevInsetInspector with DOM layer diagnostics & viewport units#94

Merged
d3mocide merged 2 commits into
mainfrom
claude/pwa-fullscreen-debug-tool-3oUrG
May 31, 2026
Merged

Expand DevInsetInspector with DOM layer diagnostics & viewport units#94
d3mocide merged 2 commits into
mainfrom
claude/pwa-fullscreen-debug-tool-3oUrG

Conversation

@d3mocide
Copy link
Copy Markdown
Owner

Summary

Enhanced the developer layout inspector to surface DOM-layer geometry (html, body, #root) and viewport unit measurements alongside existing safe-area insets. This addresses the core debugging need: identifying which DOM element is causing letterbox gaps in standalone PWA mode on iOS.

Key Changes

  • DOM Layer Measurement: Added readLayer() to measure getBoundingClientRect() for <html>, <body>, and #root independently, with color-coded visual markers (crimson/green/blue) overlaid on the screen at each layer's bottom edge
  • Viewport Units Probe: Implemented measureUnits() to resolve actual computed heights for 100vh, 100lvh, 100svh, 100dvh by creating hidden test elements—the only reliable way to see what each unit resolves to on a given device
  • Gap Detection: Added gap metric (innerHeight − #root.bottom) to quantify the mismatch between window and rendered content
  • Expanded Metrics: Captured iOS version, nav.standalone flag, display-mode media query, docElement.clientWidth/Height, screen.availHeight, and visual viewport offset
  • Copy-to-Clipboard Report: Added buildReport() function and UI button to export a plain-text diagnostic dump suitable for pasting into bug reports
  • UI Reorganization: Restructured readout panel with section labels (Mode, Safe-area insets, Viewport, Viewport units, DOM layers), scrollable content area, and color-coded layer rows with position ranges
  • Settings Panel: Updated description text to reflect expanded scope (truncated in diff but indicates "viewp..." → fuller description of DOM layer diagnostics)

Implementation Details

  • Layer visualization uses fixed-position horizontal lines at each element's bottom edge, with staggered labels (8px, 34%, 64% left offset) to keep coincident lines readable
  • Color scheme: html → red-emergency (crimson), body → green-ais, #root → cyan-adsb (blue)—matches Vertex's existing palette
  • Viewport unit probes are created, measured, and immediately removed to avoid DOM pollution
  • Gap metric turns green when zero (healthy), red when non-zero (indicates shell/window mismatch)
  • iOS version extracted via regex on navigator.userAgent; falls back to "—" if unparseable
  • All measurements use Math.round() for pixel-perfect integer values

https://claude.ai/code/session_01S9vEqUbyVKdXMWwHB7Vohn

claude added 2 commits May 31, 2026 19:17
Add the metrics that pinpoint which element causes a standalone-PWA
fullscreen gap: per-layer rendered heights for <html>, <body>, and #root
(html=crimson, body=green, #root=blue), plus 100vh/lvh/svh/dvh probes,
docEl.client, screen.availH, iOS version, split nav.standalone vs
display-mode flags, and a GAP (innerH − #root.bottom) readout that goes
red when the shell doesn't fill the window.

Visual layer bottom-edge markers overlay the live screen so a short body
line is obvious at a glance, and a Copy button dumps the full report for
bug threads. Panel scrolls within an 82vh cap to fit the larger readout.

https://claude.ai/code/session_01S9vEqUbyVKdXMWwHB7Vohn
@d3mocide d3mocide merged commit 2734810 into main May 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants