-
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
Fix navigation link block dragging error #30219
Conversation
Size Change: -1.64 kB (0%) Total Size: 1.41 MB
ℹ️ View Unchanged
|
// Don't select the element while dragging. | ||
'is-selected': isSelected && ! isDraggingBlocks, | ||
'is-editing': isSelected || isParentOfSelectedBlock, | ||
'is-selected': isSelected, |
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 do we assign the is-selected
class when useBlockProps
is responsible for this?
And could we also revert the change here: 748c632#diff-4501da117949f251043d70ffccf02c54af2a99fb80ccd33eb2d40175acdfc833L153?
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 to be honest. Might just have been a visual thing.
It was originally added in this PR - #17832 - which has a lot of comments, it might have been discussed in there at some point.
I'll remove that line.
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.
Ah, sorry, should have linked this one too: 748c632#diff-4501da117949f251043d70ffccf02c54af2a99fb80ccd33eb2d40175acdfc833R165
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.
Have removed both of the modified lines, and it still seems to work, so hopefully there's no drama from that change (cd3aa0c).
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.
If there's a problem we look for a pure CSS solution. :)
Would be good to also remove this change 748c632#diff-4501da117949f251043d70ffccf02c54af2a99fb80ccd33eb2d40175acdfc833R165 |
If we do want to make style changes based on a block being dragged, we should use a dragging class in combination with e.g. |
Description
Fixes #30177.
The thing that triggers the error is the call to the
isDraggingBlocks
selector. I'm not sure why yet. I'll do some more digging to try to fix the root cause.But this can serve as an intermediate fix.
To resolve the issue I removed a bunch of code related to that selector, and I don't really know what some of it does. It looks like one use of
isDraggingBlocks
was to hide the appenders in the nav block when dragging. I don't think it's a big issue if these are visible again.The other cases modify the
is-selected
andis-editing
classnames. It's unclear to me what that might do, but it might be that there was a need for this originally, but now there isn't (the feature still seems to work ok without this).How has this been tested?
Try dragging a navigation link (including into a nested submenu)
Expected result: The block should be drag and droppable.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: