Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not reset active item, if mouse simply moved #689

Open
benjaminr-ps opened this issue Dec 22, 2022 · 0 comments
Open

Do not reset active item, if mouse simply moved #689

benjaminr-ps opened this issue Dec 22, 2022 · 0 comments

Comments

@benjaminr-ps
Copy link

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.

tree/src/NodeList.tsx

Lines 360 to 362 in 62e0bf0

onMouseMove={() => {
onActiveChange(null);
}}

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)

benroe89 added a commit to benroe89/tree that referenced this issue Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant