Skip to content

MDL: Simplify APIs for setting whether master/detail sides should expand #11345

@rolfsmeds

Description

@rolfsmeds

Describe your motivation

The current API relies on setting a min-size on the side you want to expand to fill available space, and a size on the element you want to stay fixed size. (You can also set min-size on both to make both expand.)

This API has been found to be unintuitive, and does not lead users away from setting both sides fixed (a configuration that is not an intended use case).

Describe the solution you'd like

  • Remove setMasterMinSize and setDetailMinSize APIs
  • Use setMasterSize and setDetailSize for both minimum and fixed sizes
  • Introduce a separate setter for configuring which side should expand to fill available space, e.g. setExpand(Expand) where Expand is an enum with options MASTER, DETAIL and BOTH. Make BOTH the default.

Behavior:

  • If Expand.MASTER is set, setMasterSize defines the minimum size, but the master expands beyond that if there is space available; and setDetailSize sets a fixed size for the detail. Vice versa for Expand.DETAIL
  • If Expand.BOTH is set, setMasterSize and setDetailSize specify the minimum sizes for both sides, and both can expand (e.g. proportionally to those sizes) to fill remaining space.

The detail overlay is fixed at the size set through setDetailSize, even if Expand.DETAIL or BOTH is set, except if explicitly set to fill available space through OverlayMode or a simpler boolean alternative.

If min-content cannot be supported, both sides could default to 50% (which means no overflow can happen).

Additionally, consider introducing a constructor overload that allows setting these values:

MasterDetailLayout(String masterSize, String detailSize, Expand expandingSide)

or a single setter, e.g. setAreaSizes with the same arguments.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions