frontend-collective / frontend-collective/react-sortable-tree

canNodeHaveChildren not called if there is no row above.

Open
#536 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

As far as I can gather, there is no way to prevent showing the hover preview if hovering over the first level of the tree, because canNodeHaveChildren is not called.

I can see in the source code:

````
if (rowAbove) {
var path = rowAbove.path;
var aboveNodeCannotHaveChildren = !this.treeRef.canNodeHaveChildren(rowAbove.node);

if (aboveNodeCannotHaveChildren) {
path = path.slice(0, path.length - 1);
} // Limit the length of the path to the deepest possible

dropTargetDepth = Math.min(path.length, dropTargetProps.path.length);
}
````
Where canNodeHaveChildren is only called if there is a row above.

So, my question is: is there a way to prevent the hover preview for the first level of the tree?

Thanks!
![preventHover](https://user-images.githubusercontent.com/16178493/66123007-610aa280-e5e1-11e9-810b-e113c0386b7b.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.