jupyter-widgets-contrib / ipytree

A Tree Widget using Jupyter-widgets protocol and jsTree
MIT License
130 stars 27 forks source link

Nodes selected programmatically do not de-select other nodes when `multiple_selection=False` #81

Open bheberlein opened 1 year ago

bheberlein commented 1 year ago

If I create a Tree instance like this

from ipytree import Tree, Node

tree = Tree(multiple_selection=False)

node1 = Node('First Node')
node2 = Node('Second Node')

tree.add_node(node1)
tree.add_node(node2)

then I am unable to select multiple nodes by control-clicking (command-clicking on Mac), which is consistent with my understanding of what the multiple_selection keyword argument is supposed to do.

However, if I select the nodes programmatically, I can select multiple nodes at once:

node1.selected = True
node2.selected = True

It seems like the tree should automatically deselect node1 when node2.selected is set to True.