-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Font-Library Modal: implement new size
prop with a fixed height
#55130
Open
chad1008
wants to merge
1
commit into
trunk
Choose a base branch
from
fix/font-library-modal-sizing
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
packages/edit-site/src/components/global-styles/font-library-modal/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be missing nuance, but do we need height and max-height props if we use a size prop? Or did the other discussion end with the size collapsing the height by default? It seems like we might want to follow that up with further improvements, e.g. if you choose the small size, height collapses, if you choose medium or large, it comes with some preset default heights that you can then override further if you need to. Otherwise we've just created more technical debt here, it seems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the conclusion that we reached in #55062 (comment)
So, basically, we still need to agree on the exact behavior that preset sizes should have when it comes to the
Modal
's height — and we hypothesised doing so after a new version of theModal
component is released in the upcoming months.If you think that the changes proposed in this PR are making the situation worse, I'm happy to hold off and keep things as they are on
trunk
.This is definitely a possible approach.
More in general, I'd like to reflect on the fact that the more constraints we add to our
size
presets the least versatile those presets will be, adapting to fewer usecases (a good example is how the previous modal's was in-between themedium
andlarge
size, meaning that we'd need to use thelarge
size)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think things are becoming worse here, apologies if my somewhat terse statement sounded negative, on the contrary I appreciate attention to detail.
I mainly want to push on what we're building. The way I see it, the modal should come with some excellent defaults:
But in most cases, IMO, you should not need any local CSS at all, and the benefit would be consistent and easily recognizable modals across.
I was not able to follow the conversation on that other PR in depth, I understand the height issue was brought up mainly for the
confirm
component is that right? I think we can still serve a height by default and address that very valid concern:We can even add a height prop to the modal component itself, to avoid the local CSS. What do you think? I think we should always strive to not need local CSS overrides, especially in cases like these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this is that it's likely going to visually break all existing usages of
Modal
that assume that the component is just as large as its contents need to be.This sounds good to me 👌
I'm not sure about this, maybe @chad1008 can confirm?
If you're referring to
ConfirmDialog
, it is indeed a separate component fromModal
, and from a quick look I couldn't see any height being currently set.This sounds like a sensible approach. We could debate whether we would like to set a fixed height, or a min height
I'm personally always skeptical about React props mirroring CSS props:
style
propThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At that point in the conversation we were focused on
aspect-ratio
as a possible solution. My understanding was thatConfirmDialog
was only being brought up as an example of an implementation that might suffer fromaspect-ratio
or any other approach that effectively enforced amin-height
that was taller than what that implementation currently renders at.If we were to leave the default behavior alone (ie the
Modal
will just be as big as it needs to be), and only apply height values to some/all of our new presets, that concern should be mitigated... the smaller implementations likeConfirmDialog
aren't using a preset size so they wouldn't be impacted.Just to clarify, when writing this PR I recognized it might very well be a temporary fix to the previous solution. We're still undecided on the final answer to the preset height question. If we wind up implementing one in the new version of
Modal
, we can update this and remove the CSS. If we don't, I'll just remove the TODO in the styles and leave the code as is 🙂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, Chad.
I personally think that the changes in this PR are an improvement, since we are use the new
size
preset and adding an additional custom height constraint.So, I propose we merge this PR as-is and we continue the conversation on Modal separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for @jasmussen to take a look at this to make sure we're aligned :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a brewing conflict in #55525 (comment) so worth double checking.
But just to reiterate the high level concept I would think valuable for the modal component:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for flagging. There's definitely a lot going on in there, and I think it would be best to slow down a moment and understand step by step what changes we want to make to the
Modal
component (as an isolated, independent component)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ciampo are we still good to merge this for now? We talked about merging it above, if that's still good on your end, can I trouble you for a ✅ ? 😄EDIT: My tab for this PR hadn't refreshed for some reason so I didn't see the most recent replies about slowing down re: the potentially brewing conflict until just now.