Skip to content

Selecting a node while filtered and then unfiltering has strange check behavior #153

Open
@petertirrell

Description

@petertirrell

In the filter example (https://jakezatecky.github.io/react-checkbox-tree/) I noticed a strange behavior when filtering and checking. Taking the example at the link, if you (from the initial default state) uncheck the first element "app" so "Http" is no longer checked.

Next, type in the filter box "app" so that it filters to only the "app" root node, and the config folder (containing app.js). Check the box next to "app" so that it's node is checked.

Next, erase the text in the filter to return back to the original list of items. The "app" folder is no longer checked, nor are any of the child elements. Filtering back to "app" shows that node is still checked.

I came across this behavior in the project I'm working on, and wanted to let someone know. I'm wondering if it might be part of the filterNodes function in the example and maybe I just need to play with the filter behavior...I'm thinking maybe I'd like to retain the full tree structure when returning any levels that have a match, or something to track whether it's checking a leaf or a folder. Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions