Collapsed TreeView children are not automatically checked when parent item is checked

I have a Tree with AllowCheckChildren set to true. When I check a collapsed parent I expect all the children to also be checked in the background and to be included in the @bind-checkvalues list. Currently that's not the case.

Take a look at the Tree documentation: When I select one of the root categories that's not yet checked, I would expect the console to log that category and all it's children. But that does not happen, unless you expand the category before or after checking the item.

The steps below also demonstrate the issue on said documentation page:

  1. Check 'Condiments', after which the console only logs 'Condiments'
  2. Expand 'Condiments', after which the console logs 'Condiments' and all its expanded children
  3. Uncheck and collapse 'Condiments'. Now check it again, and this time the console logs 'Condiments' and all its children (which didn't happen in step 1)

I believe that when 'AllowCheckChildren' is set to true, all the children of the selected parent item, should automatically be checked (and included in checkedvalues) regardless of whether they are being rendered currently (or have been rendered).

Is this a bug, or am I in the wrong?

Children that are not expanded does not exist in fact.

But does that make sense/is that intended behaviour? The tree knows the hierarchy, regardless of if it's currently rendering that hierarchy in it's entirety right?

Besides, when I expand the parent the children are actually immediately checked, which insinuates that this was already the case in the background.

Isn't it more logical for the component to always include the children in the checkedvalues list as well?

The tree doesn’t know anything about children unless expanded and that’s why cannot include their values before expand.

So that means that I'm responsible for also determining the checked child items of the tree? That feels like a lot of work which the component itself should be able to do in my opinion.

If you believe you are aware of better implementation feel free to submit pull request.