-
Notifications
You must be signed in to change notification settings - Fork 39
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
Abilities to set focus by passing focusedId props #180
Conversation
One of the possible difficulties for user to use this new prop could be that the ids of the nodes are not displayed in html even if they are provided by user for each node, so without using the hardcoded id for each node user may not even know how they are calculated inside treeview. |
I noticed that in basic treeview the disabled nodes are focusable with mouse and keyboard, may be can think if we really need this AC: "- shouldn't be able to set focus on a disabled node" |
I agree that disabled nodes shouldn't be focusable. That said, I think we need to keep them focusable b/c of how the tree was originally developed which allows for children of disabled nodes to NOT be disabled (which doesn't make sense). I detailed this issue here: #93. |
@Ke1sy @mellis481 |
Hello, I find this statement a bit unclear. If the IDs for the tree aren't hard-coded or if we don't know which ID to pass, how can we determine what the user is trying to focus on? The user already has the ability to set an ID. Is this the issue you're referring to? If so, I can update the example to clarify this point. @Ke1sy |
I would recommend we don't throw an error if they pass a bad ID, but rather just don't focus anything. |
@Ke1sy It seems to me you are conflating how the developer will code programmatically set focus to a node and the user being able to set focus. Perhaps this has happened b/c you are focused on the Storybook example where we let the user set the value? In any case, the user won't be setting the node to focus. CC: @yhy-1 |
if (!focusedId) { | ||
dispatch({ | ||
type: treeTypes.clearFocus, | ||
id: treeParentNode.children[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear focus. This result in the default uncontrolled tree, ie focus on first element when they tab on tree.
fix the issue in #156