-
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
Prevent link control popover from going offscreen #42389
Conversation
Size Change: +23 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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 could produce the original issue, and applying this PR fixes it.
Similar to #42214.
Screencast
CleanShot.2022-07-13.at.15.04.43.mp4
Thanks for the PR Dan! In site editor we see this: Screen.Recording.2022-07-13.at.2.38.11.PM.movThis seems related to the issue in my comment here: #41575 (comment). |
This could have been added to 6.0.1. It's funny how the WP team keeps adding GUI features without properly testing them on all screen sizes before launch, and then these PR are constantly needed to fix them. |
@andreszs This PR is related to a Gutenberg plugin bug. It may be that a similar issue happens in 6.0.1, but the problem in the code will be unrelated because the popover code has been completely replaced in the Gutenberg plugin! I completely agree there could be better testing before merging new features. ❤️
@ntsekouras It's a much needed improvement over what's in edit: So it seems that It's quite difficult to reason about what |
@ntsekouras I think I understand the issue. Floating UI expects consumers to use its own Without that data the |
Good find @talldan!! We might need a wrapper offset middleware that always adds offset, even if we pass |
#42417 switches from custom middleware to floating-ui's middleware for frame offset. I found this issue that suggests floating ui may work automatically with iframes in the future - floating-ui/floating-ui#1711. 🤞 |
What?
Fixes #42003
Doesn't really help with #41739
Prevents the LinkControl popover from going offscreen.
Why?
It's a bug - it's hard to use the popover when it's half off the screen. 😏
How?
Adds the
__unstableShift
prop to the popovers. This prop allows the popover to shift position in all axes relative to the reference/anchor element when the popover would otherwise be positioned offscreen or behind another element.Note - I added this to the navigation link/submenu popovers, but due their z-index they don't seem to behave exactly like the other popovers.
Testing Instructions
I've tested this in the customize widgets screen and there's now a separate issue:
It looks like something happened to the z-index or stacking context. Either that or the popover previously resized.
Screenshots or screencast
Before
Kapture.2022-07-13.at.17.03.11.mp4
After
Kapture.2022-07-13.at.17.01.51.mp4