react-arborist
react-arborist copied to clipboard
Deletion behavior can be unintuitive
Consider the following couple of screencaps of the cities demo
https://github.com/brimdata/react-arborist/assets/864752/5d16cd49-1a11-4062-9120-d1a63b062463
I select two items (Anderson and Andalusia), focus on a third (Allgood) item, and hit delete. The two selected items are deleted, yet the focused item is not, and the focus jumps to the next node after deleted nodes (Anniston). This feels jarring. Without having read the code, it wouldn't make sense to me what just happened or why.
Let's say you have some intuition behind that behavior that only the selected nodes will be deleted and the focused node will not. That intuition is correct if you've selected a single node. In this example, I select a single item (Anderson) and focus on the previous item (Andalusia). After hitting backspace, The focused item is deleted, rather than the selected item.
https://github.com/brimdata/react-arborist/assets/864752/efad6e71-29ca-4cf5-8914-331ba5aadb94
This unintuitive behavior can be avoided if you use the selectionFollowsFocus prop, but I thought I'd file an issue for consideration if we want to either change this default behavior, or allow a consumer to override the behvior.