Description
Describe the bug
When selecting the first item in a shift
key held selection of multiple items, if the first item is selected via a ref or by changing the selectedItems
view state on a ControlledTree
, the starting state does not get overridden. Therefore, the previous item which was directly selected in the tree is incorrectly used as the start of the range.
To Reproduce
- Go to https://rct.lukasbach.com/docs/guides/refs
- Select "Banana" in the tree
- Click the ref button "Select items Apple and Orange"
- Hold down the
shift
key - Select "Desserts" in the tree
Expected selection is:
[Apple, Orange, Lemon, Berries, Banana, Meals, Desserts]
Actual selection is:
[Banana, Meals, Desserts]
Expected behavior
Changes to the tree's selection state which originate outside of the tree component itself should overwrite the starting item in a multiselection range
Screenshots
Indirect.selection.multiselect.-.Example.1.mov
Indirect.selection.multiselect.-.Example.2.mov
Real-world case
When clicking on a layer in the visual canvas space, the selectedItems
view state of the RCT layer tree is updated. Holding down shift
to select the end item of a selection range in the tree then results in an incorrect multiselection: