refactor(dialog): add more header flexibility#4000
Conversation
🦋 Changeset detectedLatest commit: 9a94096 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
File metricsSummaryTotal size: 1.43 MB*
dialog
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
📚 Branch previewPR #4000 has been deployed to Azure Blob Storage: https://spectrumcss.z13.web.core.windows.net/pr-4000/index.html. |
cb5d59b to
a2205c6
Compare
| "width": "100%", // forces the data-inner-container to be full width so the container query doesn't break. | ||
| }, | ||
| containerStyles: { | ||
| "width": "100%", // forces the data-outer-container to be full width so the container query doesn't break. |
There was a problem hiding this comment.
Oh noes! I believe it's the first one (the inner-container) that's creating a horizontal scrollbar at the bottom in the default story (but not the test):
I did play with it for a bit and something like -webkit-fill-available does work rather than 100%, but doesn't work in Firefox.
We could also try using isChromatic for this? I don't know if it's cool to use that for components. But it'd look something like
import isChromatic from "chromatic/isChromatic";
// all the other stuff...
wrapperStyles: isChromatic ? {
"background-color": "var(--spectrum-gray-50)",
"width": "100%", // forces the data-inner-container to be full width so the container query doesn't break.
} : {},
// ...all the rest of the stuffThere might be a better solution than that also!
Ok and one more thing on this: would we want to refactor to use inline-size instead of width? I know using logical properties for the storybook wrapper styles is a little less critical than in the styles we ship, so I definitely don't consider that blocking at all.
There was a problem hiding this comment.
I left only a few comments, but they're lengthy! The container query works great as far as I can see, just left a comment about the margin-block-end on the heading.
I also noted a small issue with the horizontal scrolling in Storybook, otherwise though, this looks fantastic!
| } | ||
|
|
||
| .spectrum-Dialog-heading { | ||
| margin-block-end: var(--spectrum-standard-dialog-spacing-title-to-description); |
There was a problem hiding this comment.
Do you want a mod here? var(--mod-standard-dialog-spacing-title-to-description, var(--spectrum-standard-dialog-spacing-title-to-description))? I guess this was just moved up from below though maybe?
Although maybe more importantly, am I missing the spot where this would take effect? I think this might be taken over by the margin-block-end: 0 in the container query in every case 🤔

Or maybe we don't need this? You've already got a nice gap between the heading and the header content wrapper, and the header has its own margin-block-end that would provide space between the it and the dialog content if the header content wrapper wasn't there.
There was a problem hiding this comment.
| "width": "100%", // forces the data-inner-container to be full width so the container query doesn't break. | ||
| }, | ||
| containerStyles: { | ||
| "width": "100%", // forces the data-outer-container to be full width so the container query doesn't break. |
There was a problem hiding this comment.
Oh noes! I believe it's the first one (the inner-container) that's creating a horizontal scrollbar at the bottom in the default story (but not the test):
I did play with it for a bit and something like -webkit-fill-available does work rather than 100%, but doesn't work in Firefox.
We could also try using isChromatic for this? I don't know if it's cool to use that for components. But it'd look something like
import isChromatic from "chromatic/isChromatic";
// all the other stuff...
wrapperStyles: isChromatic ? {
"background-color": "var(--spectrum-gray-50)",
"width": "100%", // forces the data-inner-container to be full width so the container query doesn't break.
} : {},
// ...all the rest of the stuffThere might be a better solution than that also!
Ok and one more thing on this: would we want to refactor to use inline-size instead of width? I know using logical properties for the storybook wrapper styles is a little less critical than in the styles we ship, so I definitely don't consider that blocking at all.
ced82f0 to
00bcbe5
Compare
| ...(showTestingGrid && { "inline-size": "100%" }), // Applies conditional styles based on showTestingGrid- forces the data-inner-container to be full width so the container query doesn't break. | ||
| }, | ||
| containerStyles: { | ||
| ...(showTestingGrid && { "inline-size": "100%" }), // forces the data-outer-container to be full width so the container query doesn't break. |
There was a problem hiding this comment.
@rise-erpelding What do you think about this approach instead? I didn't notice the horizontal scroll before, but I believe it's gone now everywhere. Let me know!
- adds container query for fullscreen/fullscreenTakeover dialogs - increases the max-inline-size for the dialog to 864px for query - moves fullscreen/fullscreenTakeover grid layout to container query
00bcbe5 to
9a94096
Compare


Description
This work adds a container query to the
.spectrum-Dialogelement. The container query should allow fullscreen/fullscreenTakeover dialogs to reflow the content grid sooner. The ability to reflow sooner should be useful when implementations and users elect to add a component to the dialog's header area (i.e. the steplist in the fullscreen dialog example), allowing the dialog heading to fill up more space instead of wrapping so much, even on large-ish screens.Because of the container query, however, extra
containerStylesandwrapperStyleswere added to the test canvases to make sure the entire dialog is captured, instead of just the minimum inline sizes.Jira/Specs
CSS-1092
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Jira/Specs
CSS-1092
Validation steps
spectrum-twopreview)..spectrum-Dialog-headerContentWrapperelement and its contents in your browser inspector, the dialog's heading fills all of its space.Additional validation
Regression testing
Validate:
Screenshots
🚫 Before (820px)
✅ After (also 820px)
To-do list