How to hide nodes when text is selected?