Skip to content

fix: apply masterSize to master area even without detail content#11147

Closed
DiegoCardoso wants to merge 1 commit intomainfrom
fix/mdl/master-size-without-detail
Closed

fix: apply masterSize to master area even without detail content#11147
DiegoCardoso wants to merge 1 commit intomainfrom
fix/mdl/master-size-without-detail

Conversation

@DiegoCardoso
Copy link
Copy Markdown
Contributor

Summary

  • Remove [has-detail] requirement from CSS selectors that set master width/height from masterSize, so the master area respects its fixed size even when no detail content is present
  • Add tests for horizontal and vertical orientations verifying master sizing without detail

Fixes #10318

Root Cause

The CSS selectors applying masterSize to the master part required [has-detail]:

:host([orientation='horizontal'][has-master-size][has-detail]) [part='master'] {
  width: var(--_master-size);
}

Without detail content, has-detail is absent, so the width/height rules never applied. Combined with flex-shrink: 0 (which IS applied) and no flex-grow/flex-basis (blocked by has-master-size), the master ended up with no sizing — causing children without intrinsic size (e.g., <vaadin-grid>) to collapse to zero.

Fix

Removed [has-detail] from the two selectors. This is safe because:

  • max-width: 100% / max-height: 100% on [part] prevents overflow
  • !important overrides in drawer/stack mode are unaffected

Test plan

  • Existing tests pass (79/79)
  • New test: horizontal master gets 400px width without detail
  • New test: vertical master gets 200px height without detail
  • Manual: dev/mdl-size.html — grid should have 400px width

🤖 Generated with Claude Code

)

Remove [has-detail] requirement from CSS selectors that set master
width/height from masterSize. Without this fix, elements inside the
master area that lack intrinsic size (like vaadin-grid) collapse to
zero width when no detail content is present.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the master expands once you open the detail, which looks quite jarring:

Bildschirmaufnahme.2026-02-17.um.07.18.56.mov

But keeping the master on a fixed size when the details are displayed as an overlay is also weird. I think I would expect that if the details are going to be opened as an overlay, the master size would still cover the full size. It would only respect the width if details would be shown next to it. The problem with that is that we can only detect that once the details are actually added to the DOM, otherwise we have nothing to measure.

ping @rolfsmeds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that (the master becoming full-size again once the detail goes overlay) is an issue also with a non-fixed-size master (it looks a bit jarring regardless, because at that point the master has already shrunk down to its min-size).

It would probably look better if the detail popping out didn't affect the size of the master, but with a semitransparent detail, it might look weird that there's just empty space next to the master? But maybe that would still be better?

If we change this, it would mean that

  • With a fixed-size master, the master would always be exactly that size (except if viewport is smaller)
  • With an auto-sized master (with a min-size), the master would be fixed to its min-size when the detail is overlay.

@DiegoCardoso DiegoCardoso deleted the fix/mdl/master-size-without-detail branch March 17, 2026 11:20
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.

MDL master part gets zero width when detail hidden

3 participants