dgreene1 / react-accessible-treeview

A react component that implements the treeview pattern as described by the WAI-ARIA Authoring Practices.
https://dgreene1.github.io/react-accessible-treeview
MIT License
257 stars 37 forks source link

Wrong group node selection #189

Open urrri-redis opened 1 month ago

urrri-redis commented 1 month ago

Describe the bug

Selection of group nodes is different, depends on order of selectedIds

To Reproduce

  1. Go to Checkbox with controlled selectedIds
  2. Write following list of ids 12,13,14,15,8,9,10 to the IDs input and press "Set" button
  3. Node "Tea-11" is not selected, though all its children are.
  4. Change list of IDs to 8,9,10,12,13,14,15 and press "Set" button.
  5. All nodes are selected correctly.

Expected behavior Order of IDs should not change selection behavior. Group node should be always represent state of its children selection

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

dgreene1 commented 1 month ago

@urrri-redis are you experiencing this in your production application?

I ask because the IDs you set don’t seem like a real use case—like why would someone select everything underneath a branch but not just select the whole branch?

Either way, we’re open to PRs. This is a volunteer maintained open source repo.

urrri-redis commented 1 month ago

@dgreene1 this is absolutely correct way to have selected ids for fully selected branch. There are 3 ways:

some trees allow choose the way to get selection ids, some allow to make it custom way, but all of them must understand all 3ways, when receive selection IDs, even if they are mixed