react-component / react-component/tree

Is there a way to programmatically focus tree / node?

Open
#359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
490
Avg merge
3d 17h
Merged PRs (30d)
5

Description

I was able to achieve this by:

function Tree () {
  const rcTree = useRef()

  useEffect(() => {
    document.querySelector('.rc-tree input').focus()
    const state = rcTree.current.state
    state.activeKey = focusedId
    rcTree.current.setState(state)
  })

  return (
    <TreeView ref={rcTree} />
  )
}

But its a little hacky non-react way.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the TreeView usage and the current focus and active-node behavior described in the issue. Define a supported React-facing way to focus the tree or a node without querying the DOM or mutating internal state, and document how completion can be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.