Do not reset active item, if mouse simply moved

未關閉
#689 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
react, typescript
領域
frontend

研究方向

從 src/NodeList.tsx 的第 360-362 行開始,並使用連結的 CodeSandbox 範例重現此行為。追蹤滑鼠移動何時會重設作用中項目,並將其與使用滑鼠選取項目的情況進行比較;當選取的項目保持作用中,同時使用者仍能繼續使用鍵盤導覽時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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)

主要語言
TypeScript
星號
1.3k
分支
494
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react-component/tree 的其他 Issue

查看 react-component/tree 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。