tree icon indicating copy to clipboard operation
tree copied to clipboard

Do not reset active item, if mouse simply moved

Open benjaminr-ps opened this issue 2 years ago • 0 comments

Status Quo

Using the keyboard navigation, the tree shows an active active item.

Problem

If the user moves the mouse cursor, the active item is reset. https://github.com/react-component/tree/blob/62e0bf0b91d86b6e42fee69870ada9a4640b6c6f/src/NodeList.tsx#L360-L362

Use Case

User can select a tree item with mouse cursor, and from there on, continue to use the keyboard navigation. Please see a sample implementation: https://codesandbox.io/s/basic-antd-5-0-7-forked-b0nu42?file=/demo.tsx

Hint

Unfortunately, I have to set the focus by hack, to activate the keyboard navigation. It would be awesome, if tree component supports a interface property, like "focusOnClick". IMHO, the tree could be focused by default, when clicked. (But not sure about other user's use-cases)

benjaminr-ps avatar Dec 22 '22 07:12 benjaminr-ps