frontend-collective / react-sortable-tree

Drag-and-drop sortable component for nested data and hierarchies
https://frontend-collective.github.io/react-sortable-tree/
MIT License
4.9k stars 897 forks source link

The location of Highlight on the searched node is moved when the parent node is collapsed or expand. #469

Open dan-choe opened 5 years ago

dan-choe commented 5 years ago

Reporting a Bug?

The location of highlight on the searched node must be stick to the node when its parent node is collapsed or expand. The highlight is remained in the same position! This is pretty odd.

You can check this bug on the demo. https://frontend-collective.github.io/react-sortable-tree

  1. Search: Egg
  2. Egg node is highlighted
  3. Collapse its parent, Chicken, node.
  4. Then you can see "Button(s) can be added to the node" node is highlighted.
ericbowden commented 5 years ago

Other matches get their highlights changed as well:

  1. Search: Depth
  2. maxDepth node is highlighted, with the following 3 children highlighted as well
  3. collapse maxDepth node
  4. The children highlighting transfers to the following siblings of maxDepth
iaminvictus1993 commented 3 years ago

hack way: 1 . remove itself search class style .rstcustom__rowSearchMatch 2 . searchFinishCallback store the search result in react state

  1. generateNodeProps specify the search node style by the search matches in the state