-
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
Block Editor: Fix overflowing LinkControl
.
#20154
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,12 @@ $block-editor-link-control-number-of-actions: 1; | |
.block-editor-link-control { | ||
position: relative; | ||
min-width: $modal-min-width; | ||
|
||
.components-popover__content & { | ||
min-width: unset; | ||
epiqueras marked this conversation as resolved.
Show resolved
Hide resolved
|
||
width: 90vw; | ||
max-width: $modal-min-width; | ||
} | ||
} | ||
|
||
// LinkControl popover. | ||
|
@@ -147,7 +153,6 @@ $block-editor-link-control-number-of-actions: 1; | |
text-overflow: ellipsis; | ||
max-width: 230px; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
Comment on lines
153
to
-150
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The three styles What was the purpose for removing Contrast that with how it behaves after these changes: I think either could work, but it seems like the behavior of the former was likely a conscious design decision to keep the heights of these suggestions consistent (cc @getdave). I'd guess this might have been related to my comment at #20154 (comment) ? It feels to me we shouldn't want there to be an explicitly assigned There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed it because the header still stretches up to 230px with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it was deliberate to ensure consistent height Sorry i dont get these pings. I need better GH skills! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not working for me in Chrome. The content is cut off without an ellipsis. |
||
} | ||
|
||
.block-editor-link-control__search-item-title { | ||
|
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.
Why the LinkControl should be aware that. it can be used in a Popover?
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.
Are you saying the parent component should apply a custom class name?
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 know but it feels like:
Now, I don't know the details of this issue to argue exactly what the fix should be.
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.
Agreed, this PR furthers that.
This requires a bigger refactor of popovers.
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.
It doesn't seem like it since there's an explicit mention of popover in the link control style.
The popover should already have the logic to adapt the width to the viewport built-in. Maybe there's a bug there.
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.
Which is used to remove pixel-based dimension constraints.
Yeah, that logic is not very robust and it overflows the screen in most cases.
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.
Yes, this is cool but can't we do it consistently without any mention of the popover class. I'm thinking the LinkControl can also be shown in narrow contexts independent of the Popover being present or not.
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.
No, because the way we can dampen the effect of the popover bug here does not necessarily work in other narrow contexts. We can only assume a
90vw
is OK because the popover renders on top of everything.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.
Do you think a generic solution based on "react-resize-aware" would work here like the Placeholder 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.
Yes, or
react-spring/react-use-measure
.