Skip to content

Fix #58: detail modal collapses to 0-height in Chrome / HA companion app (v1.2.7) - #59

Merged
adamoberley merged 1 commit into
HABirdDashboardfrom
fix/58-modal-collapse
Jul 24, 2026
Merged

Fix #58: detail modal collapses to 0-height in Chrome / HA companion app (v1.2.7)#59
adamoberley merged 1 commit into
HABirdDashboardfrom
fix/58-modal-collapse

Conversation

@adamoberley

Copy link
Copy Markdown
Owner

Closes #58.

Problem

The species detail modal collapsed to a thin strip showing only its padding in Chrome and the Home Assistant companion app (Android WebView). Firefox and Safari were fine.

Root cause

.modal-card was capped with max-height: calc(100vh - 48px). The card build rewrites viewport units to container-query units, so the shipped card had max-height: calc(100cqh - 48px). When Home Assistant lays the card out with an indefinite height (masonry / content-sized slots — which Chrome and the companion WebView hit), Blink resolves 100cqh to 0, so the cap became calc(0 - 48px) → clamped to 0px, and the modal shrank to just its padding. Firefox and Safari resolve the unit against the rendered height, so they were unaffected.

Fix

Cap against the overlay instead of the viewport: max-height: 100%. #detail-modal is inset:0 with 24px padding, so a flex child's 100% resolves against that overlay's content box — equal to the old calc(… - 48px) value on a normal viewport, but the overlay's height is always definite, so it never collapses.

Verification (Blink engine, same as Chrome/WebView)

  • Reproduced the collapse in a card harness with an indefinite-height slot: max-height computed to 0px, card height 58px (padding only).
  • After the fix, the modal renders at 431px across indefinite-height, flex-column, definite-600px, and short-360px layouts. Full content confirmed by screenshot.
  • npm test13/13 suites pass (including test-card.js / test-xss.js, which parse the rebuilt dist).

Changes

  • homeassistant/www/styles.css — the one-line fix (with explanatory comment)
  • dist/habird-card.js — rebuilt
  • CHANGELOG.md — v1.2.7 entry
  • package.json, homeassistant/card/build.js — version bump to 1.2.7

.modal-card capped its height with `max-height: calc(100vh - 48px)`,
which the card build rewrites to `calc(100cqh - 48px)`. When Home
Assistant lays the card out with an indefinite height (masonry /
content-sized slots), Blink resolves 100cqh to 0, so the cap clamped
to 0px and the modal shrank to just its padding. Firefox and Safari
resolved the unit against the rendered height, so they were unaffected.

Cap against the inset:0 overlay with `max-height: 100%` instead:
identical to the old value on a normal viewport, but the overlay's
height is always definite so it never collapses.

Rebuilt dist, bumped to v1.2.7, added changelog. 13/13 test suites pass.
@adamoberley
adamoberley merged commit 2fe629a into HABirdDashboard Jul 24, 2026
1 of 2 checks passed
@adamoberley
adamoberley deleted the fix/58-modal-collapse branch July 24, 2026 16:13
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.

Detail modal collapses to 0-height in Chrome / HA Companion App

1 participant