diff --git a/packages/host/app/components/host-mode/stack-item.gts b/packages/host/app/components/host-mode/stack-item.gts index f9ec2e060ff..5b1fbdcf43e 100644 --- a/packages/host/app/components/host-mode/stack-item.gts +++ b/packages/host/app/components/host-mode/stack-item.gts @@ -216,6 +216,16 @@ export default class HostModeStackItem extends Component { padding-top: var(--boxel-sp-2xl); z-index: 0; pointer-events: none; + /* The top card is content-sized (height: auto, see + styleForStackedCard) with an 80cqh floor so the page scrolls as a + page. But a percentage height never resolves against min-height, so + an isolated template that fills its container (height: 100%, + container-type: size, cqh units) had nothing to fill and collapsed + to its padding. A grid area IS definite for its item even when the + grid's own height is auto: the single 1fr row hands the card the + floor when content is short and still grows when it is tall. */ + display: grid; + grid-template-rows: minmax(0, 1fr); } .host-mode-stack-item:not(.buried) { diff --git a/packages/host/tests/acceptance/host-mode-test.gts b/packages/host/tests/acceptance/host-mode-test.gts index 78d9c57d3ae..4a9e0e77843 100644 --- a/packages/host/tests/acceptance/host-mode-test.gts +++ b/packages/host/tests/acceptance/host-mode-test.gts @@ -686,6 +686,42 @@ module('Acceptance | host mode tests', function (hooks) { assert.dom('[data-test-pet-isolated="Mango"]').exists(); }); + test('a fill-height isolated template fills the top stack card instead of collapsing to its content', async function (assert) { + // Pet's isolated root is `height: 100%`. The top card is content-sized + // (height: auto) with a min-height floor, and a percentage height never + // resolves against min-height — so without a definite box handed down by + // the stack item, the root collapsed to the height of its

. + await visit('/test'); + await click('[data-test-boxel-filter-list-button="All Cards"]'); + await waitFor('[data-test-cards-grid-item]'); + await click( + `[data-test-cards-grid-item="${testHostModeRealmURL}Pet/mango"]`, + ); + await waitFor('[data-test-pet-isolated="Mango"]'); + + let item = document.querySelector( + `[data-test-host-mode-stack-item="${testHostModeRealmURL}Pet/mango"]`, + )!; + let root = document.querySelector( + '[data-test-pet-isolated="Mango"]', + )!.parentElement!; + let itemStyle = getComputedStyle(item); + let offered = + item.getBoundingClientRect().height - + parseFloat(itemStyle.paddingTop) - + parseFloat(itemStyle.paddingBottom); + let filled = root.getBoundingClientRect().height; + + assert.ok( + filled >= offered - 1, + `isolated root fills the stack item (root ${filled}px, item offers ${offered}px)`, + ); + assert.ok( + filled > root.querySelector('h2')!.getBoundingClientRect().height, + 'root is taller than its own content', + ); + }); + test('viewCard tabs persist after stacking and closing cards in host mode', async function (assert) { let primaryCardId = `${testHostModeRealmURL}ViewCardDemo/index`; let firstStackCardId = `${testHostModeRealmURL}ViewCardDemo/secondary`;