react-arborist
react-arborist copied to clipboard
How to programmatically unfocus node(s)?
Is there a way to programmatically unfocus a node without resorting to setting a bogus one? This obviously isn't the right way to go about it, since I can't get rid of the console log (which definitely is not desired).
It also seems that I'm having to "unfocus" when deselecting nodes using tree.deselectAll(). Since there isn't an unfocus method, I'm having to use a bogus value which then outputs in the console.
Could we
- Remove the console log
- add an unfocus method
Yes, we can certainly remove that console.log. And yes, we can add a .blur() method on the tree. I'm not sure whether it should return focus to the tree container, or to document.body or something else?
Can you explain your use case? What is it youre trying to do by removing focus?
You can also remove focus by simply focusing on a different element.
Is it a styling concern? If you are styling the nodes with .isFocused, you can change the css selector to use :focus and that will only be applied when the tree has focus.
I removed that console.log in this PR: https://github.com/brimdata/react-arborist/pull/79
Thank you. I apologize for the delay in getting back to you. I have been busy, but I will respond with more details shortly.
Great work on this library btw!