-
-
Notifications
You must be signed in to change notification settings - Fork 604
-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
ext-dnd5: Unwanted expanding of folder node when a node is dragged above it #875
Comments
I've updated Fancytree to v2.29.1 but this issue is still occurring. This issue continues to be reproducible in the Fancytree complex demo. |
Thank you for the feedback! |
I've cleared the browser cache, but the problem still occurs. Reproducible on Firefox and Chrome. |
This is very strange indeed. I see this behavior (Chrome and Safari, macOS) I don't know what's going on there. In case you want to look into it or add some logging, this is the relevant spot in jquery.fancytree.dnd5.js: case "dragover":
// The dragover event is fired when an element or text
// selection is being dragged over a valid drop target
// (every few hundred milliseconds).
// console.log(event.type, "dropEffect: " + dataTransfer.dropEffect)
LAST_HIT_MODE = handleDragOver(event, data);
allowDrop = !!LAST_HIT_MODE;
// console.log(event.type, LAST_HIT_MODE, DRAG_OVER_STAMP)
if( LAST_HIT_MODE === "over" &&
!node.expanded && node.hasChildren() !== false ) {
if( !DRAG_OVER_STAMP ) {
DRAG_OVER_STAMP = Date.now();
} else if( dndOpts.autoExpandMS &&
(Date.now() - DRAG_OVER_STAMP) > dndOpts.autoExpandMS &&
(!dndOpts.dragExpand || dndOpts.dragExpand(node, data) !== false)
) {
node.setExpanded();
}
} else {
DRAG_OVER_STAMP = null;
} |
Not directly related to this bug, but very rarely in this exact part of code (line 626 in jquery.fancytree.dnd5.js to be precise), the "node" variable happens to be null. Other cases in the switch do have a safeguard such as :
The "dragover" case could also use it ? |
Thanks, I'll add a guard. |
@mar10 - I finally took the time to look into this issue further. It is determined not to be an issue with the library itself. My code in the |
Thanks! |
In a Fancytree widget with folders and child nodes, if a node is dragged and dropped immediately above a folder to reposition it there, the folder automatically expands. There does not appear to be a way to limit the auto-expand behaviour to only do it when dragging a node to a folder.
This behaviour is reproducible in the complex demo of Fancytree: http://wwwendt.de/tech/fancytree/demo/#sample-multi-ext.html.
Steps to Reproduce:
Actual Result:
The "Music" folder is expanded, even though the node wasn't dropped into it.
Expected Result:
The "Music" folder should remain collapsed. It should only expand (after a short delay) if the "Sub item" node was dragged on to the folder, signifying the intention to move the node into the folder.
Other Info:
Firefox 60
Fancytree version 2.23.0 with ext-dnd5
jQuery 3.2.1
The text was updated successfully, but these errors were encountered: