-
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
[Components - Popover]: Fix regression of inbetween inserter in site editor #42329
[Components - Popover]: Fix regression of inbetween inserter in site editor #42329
Conversation
Size Change: -2 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.
Great catch, thanks for the follow-up @ntsekouras, I could reproduce the issues in the site editor (but not the post editor) and this PR fixes the issue 👍
I can see the logic we went with in the previous PR of attempting to only call the callback if it has a real value, but in this case, fixing the bug seems higher priority than preserving that behaviour! Would it be worth updating the readme to flag that the function will potentially be called with an undefined
value?
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 the fix @ntsekouras 👍
The reasoning behind calling the function with a potentially undefined value makes sense to fix the issue. It does seem like something we should document though.
✅ Could replicate the issue in Site Editor on trunk
✅ Issue wasn't present in Post Editor on trunk
✅ Applying the changes in this PR resolves the issue
✅ Confirmed Block Popovers and the list view drop indicator are positioned the same between trunk and this branch
Before | After |
---|---|
Screen.Recording.2022-07-12.at.12.31.40.pm.mp4 |
Screen.Recording.2022-07-12.at.12.33.13.pm.mp4 |
af02723
to
bf58a35
Compare
I'm possibly seeing a bit of a performance drop in drag and drop after checking out this PR. I tested in the demo post (http://localhost:8888/wp-admin/post-new.php?gutenberg-demo), dragging a paragraph. Dragging to particular areas in the post seems to cause a lot of lag and glitchiness, like some code is triggering repetitively. It doesn't seem perfect in I tested using Brave browser on Mac OS. Anyone else seeing the same? |
I gave it a look too but honestly I can't really tell with the naked eye. More in general I'm good with this PR being merged, but I'm also going to play devil's advocate: given how
This is good to know, but unfortunately it wasn't documented anywhere. Relying on tightly-couple logic and ad-hoc exceptions across packages will not serve us well in the long term, and we're already paying the price with the numerous regressions that the Popover refactor surfaced. |
I agree with that and I'm too investing time to fully understand how to make everything work as it should be without 'hacks' or stop gap solutions - still not there yet 😄 . Having said that, the specific PR just removes the extra check that some I'm going to merge this and keep on studying the issues we have and all the current implementation to help make the correct adjustments where needed. |
What?
#42076 seems to have caused a regression. This PR removes the extra check for
anchorRefFallback.current
. I think the early return in the old implementation was because the computation was happening inside a useLayoutEffect with different dependencies and order.I think
getAnchorRect
should be called even without a fallback ref as many implementations don't take this into account and return something different.. The below is @ciampo 's comment from the original PR:Regression
regression.mov
After
Screen.Recording.2022-07-11.at.4.13.49.PM.mov