Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
289 stars 76 forks source link

Slotted block elements in dialog's `content-top`/`content-bottom` slots hug content #10140

Open nwhittaker opened 2 months ago

nwhittaker commented 2 months ago

Check existing issues

Actual Behavior

If a block element is slotted into a dialog component's content-top or content-bottom slots, the element loses its block display and hugs its content as if it was an inline element.

Screenshot 2024-08-21 at 6 47 50 PM

Expected Behavior

The slotted block elements maintain their block display.

Screenshot 2024-08-21 at 6 48 32 PM

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/NWZYLNK

Reproduction Steps

  1. Visit the sample
  2. Use the slotted elements' lightpink background color to judge whether or not they're stretching to fill the width of their container or hugging their content instead.

Reproduction Version

2.11.1

Relevant Info

I would question if it's appropriate/expected for components to be placing <slot> elements within flex layouts. It's not documented, so it leads to unexpected layouts where block elements don't behave like block elements by default.

Additionally, if the user needs a flex layout, they'll likely slot an element with a flex layout anyway since there's no way to fully customize the other flex-related styles on the slot's container.

Regression?

No response

Priority impact

impact - p2 - want for an upcoming milestone

Impact

A workaround is to add flex: 1 styles to the slotted elements.

Calcite package

Esri team

ArcGIS Field Apps

jcfranco commented 1 month ago

@nwhittaker makes a solid point. Since we don't explicitly document the parent display of slotted content, developers are left guessing, which isn't great for DX.

I believe we use display: flex in several places, but I doubt it's consistent for all slot containers (I could be wrong on this).

We should discuss this further to see what our options are since this is a concern for all components. cc @driskull @macandcheese @geospatialem

geospatialem commented 1 month ago

Spike next steps: