-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: Modal
Height Controls
#55062
Comments
I guess we could at most set some proportionate min-height based on the width, but I'd be quite conservative with it |
How about trying an |
It wouldn't work if we wanted to impose a fixed height (although I'm not sure it would be a good approach) |
|
Respecting a desired height with ... {
...
width: 200px/400px/600px/800px;
aspect-ratio: 2/1;
min-width: 33dvw;
max-width: calc(100dvw - 2rem);
min-height: 300px;
max-height: calc(100dvh - 2rem);
} |
@jameskoster what do you refer to when you mention "this solution" ? I think that this conversation is already about potentially adding a preferred aspect ratio to the existing size presets. I'd also caution us against adding too many specific styles to a generic component like |
@ciampo never mind, my point was that you'd only need the modal height to be fixed when there's a sub-navigation (like the fonts example in the OP, or the Preferences modal in the editor). But thinking about it some more there are other legitimate uses cases, like searching within a modal. If the aspect-ratio idea doesn't work out, another option could be to try the command palette approach. There the modal height still 'hugs' its contents, but since it's a fixed distance from the top of the viewport (rather than centrally aligned) it works okay. |
What if instead the top of the modal was positioned consistently, regardless of content height? Instead of an absolute center. |
Based on some testing I've done just now, when When combined with the I can certainly look into removing If that doesn't sound like a good path, maybe we apply a fixed hight to just one of the presets? Maybe |
I think I'm losing track of exactly what issue are trying to solve here. Looking at the initial example at the top of this issue, to me it looks okay that the consumer of I get the convenience of offering some preset sizes, and why we may also want to add height to those presets. But we can not expect to cover all use cases of |
My only concern was that in cases where the height of the If we think that's something we'd prefer to let consumers manage directly via CSS, that works for me, but I wanted to raise the question once I saw it. |
Why I was thinking of a solution that maintains the origin positioning, regardless of height change. |
Got it, thank you both! I guess one solution wouldn't prevent the other?
One thing I'm going to say is that we're about to start working on a new version of the |
Cool. I can plan on tackling it that way, and in the meantime just leave the font-library hight fixed as it is today 👍 Thanks everyone!! |
We recently implemented some preset sizes for
Modal
via thesize
prop:small
,medium
,large
, andfill
. (fill
is analogous to and will eventually replace theisFullScreen
prop)See #54471 for more, but the goal of this change was to make it easier for consumers to specify a width for their modals without having to resort to excessive style overrides.
An example of where this can be helpful is the font library modal in the site editor, where a temporary workaround is currently in place.
This is an interesting case, because while our new prop was primarily focused on widths (to avoid things like paragraph tags wouldn't push the modal to full viewport width), the font library also has height needs. Right now it's using
isFullScreen
, which creates a modal that is... you guessed it... full screen, with an a small buffer on each side. Font library is then explicitly limiting the width to65vw
. That meansisFullScreen
is really only in place to make the modal taller than it would be based on content alone.The new
size = "large"
option would be a good fit here, giving a workable width on medium and large devices but allowing a full screen mobile experience. Except for the height issue. The problem is that the different tabs contained within this particularModal
are all different heights. That means switching tabs creates an unsightly jumping effect whensize: large
is applied:Screen.Recording.2023-10-04.at.16.10.58.mov
Having a consistent height that can be specified by the consumer would be helpful here. It can be accomplished with CSS, but would it be preferable for
Modal
provide a built-in solution?Possible ideas:
isFullHeight
that would have the sam height effect ofisFullScreen
, but not impact width at all.large
fill the screen vertically, maybe set specific min-heights for each?Curious what others think from a component/design perspective. cc @ciampo @brookewp @andrewhayward @WordPress/gutenberg-design
The text was updated successfully, but these errors were encountered: