Skip to content

feat: calculate detail size automatically when not explicity set#11403

Merged
vursen merged 25 commits intomainfrom
mdl/detail-auto-size
Mar 31, 2026
Merged

feat: calculate detail size automatically when not explicity set#11403
vursen merged 25 commits intomainfrom
mdl/detail-auto-size

Conversation

@vursen
Copy link
Copy Markdown
Contributor

@vursen vursen commented Mar 23, 2026

Description

Previously, the detail area always used a fixed default size (15em) unless detailSize was explicitly set. This meant developers had to manually specify a size for every use case to avoid content being either too tight or wasting space.

Now, when detailSize is not specified, the component automatically measures the intrinsic size of the detail content by placing it in a min-content CSS grid column when it first appears, caches the result, and uses it as the column size afterwards. This gives a good default without requiring any configuration. Setting detailSize explicitly still works as before and takes precedence.

A new public recalculateLayout() method is provided for cases where the detail content changes dynamically (e.g., opening a nested master-detail layout) and the cached size needs to be re-measured. Because this method triggers synchronous DOM reads and writes that force layout recalculation, it can be expensive, so you should call it with caution and avoid calling it too frequently. The only place it is called automatically is the _setDetail protected method used by Flow to support variable view sizes.

Part of #11348

Type of change

  • Feature

@vursen vursen changed the title feat: calculate detail size using min-content and when not explicity set feat: calculate detail size using min-content when not explicity set Mar 23, 2026
@vursen vursen force-pushed the mdl/detail-auto-size branch 8 times, most recently from 6a11248 to b838998 Compare March 26, 2026 07:56
@vursen vursen changed the title feat: calculate detail size using min-content when not explicity set feat: calculate detail size automatically when not explicity set Mar 27, 2026
@vursen vursen force-pushed the mdl/detail-auto-size branch 11 times, most recently from 23219d5 to 7d3fe4d Compare March 30, 2026 09:39
@vursen vursen marked this pull request as ready for review March 30, 2026 10:20
@vursen vursen requested a review from web-padawan March 30, 2026 10:20
vursen and others added 15 commits March 31, 2026 14:05
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…l sizing

Wrapping recalculateLayout in queueMicrotask ensures Lit elements
have completed their rendering before layout measurement occurs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/master-detail-layout/ARCHITECTURE.md
#	packages/master-detail-layout/src/vaadin-master-detail-layout.js
#	packages/master-detail-layout/test/dom/__snapshots__/master-detail-layout.test.snap.js
#	packages/master-detail-layout/test/dom/master-detail-layout.test.js
#	packages/master-detail-layout/test/master-detail-layout.test.js
@vursen vursen force-pushed the mdl/detail-auto-size branch from 7bcc0da to 2b8cfd2 Compare March 31, 2026 10:09
vursen and others added 2 commits March 31, 2026 14:38
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
web-padawan and others added 4 commits March 31, 2026 15:26
- __checkOverflow() → detectOverflow() (extracted to standalone helper)
- --_master-column → --_master-extra in CSS snippets
- display: none/block → visibility: hidden/visible for placeholder
- Document fill: 'forwards' and async _finishTransition via microtask
- Document backdrop fade (opacity + pointer-events, not display)
- Document overflow: clip replacing overflow: hidden
- Document stale rAF safety invariant
- Update CSS resting state description (translate + visibility)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@vursen vursen merged commit e8269d6 into main Mar 31, 2026
10 checks passed
@vursen vursen deleted the mdl/detail-auto-size branch March 31, 2026 12:49
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