-
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
List View: Fix stuck dragging mode in UI in Firefox when dealing with deeply nested lists #60845
List View: Fix stuck dragging mode in UI in Firefox when dealing with deeply nested lists #60845
Conversation
… deeply nested lists
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +6 B (0%) Total Size: 1.75 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.
Thanks for the quick review! |
… deeply nested lists (#60845) Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: diggeddy <diggeddy@git.wordpress.org>
I just cherry-picked this PR to the update/fixes-for-wp-6-5-3 branch to get it included in the next release: 06e9898 |
… deeply nested lists (#60845) Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: diggeddy <diggeddy@git.wordpress.org>
What?
Part of #49563
Fix an issue where sometimes in Firefox, after dragging and dropping within the list view, the list view would become stuck in a dragging-like state, so there would be an unexpected additional whitespace between some list view items, with the drop indicator displaying when it shouldn't.
Kudos @diggeddy for raising the issue in #49563 (comment)
Why?
It seems that (for some reason) in Firefox, the order or presence of the
onDragEnd
callback firing correctly and clearing out the throttled drag callback and target state is unreliable. I couldn't ascertain whether this is due to a browser issue, Gutenberg code, or a combination of the two. However, for now, a fix appears to be to also add thethrottled.cancel()
and target clearing code to theonDrop
callback. Nothing bad should happen if these are called too frequently when dropping a list item, but it is a problem if they're not called correctly, as can be seen in the before / after videos below.How?
In the List View's drop zone / drag and drop handlers, add the following to the
onDrop
callback:throttled.cancel
to cancel out any scheduled call to update the drop targetundefined
) so that any styling rules that are active while a target is present are removedTesting Instructions
trunk
, sometimes, it's possible to get stuck in a state where the list view drop indicator is still visible after dropping, and there is an unexpected space between some list view items.Testing Instructions for Keyboard
Screenshots or screencast
Before
2024-04-18.15.32.52.mp4
After
2024-04-18.15.35.11.mp4