check if node is selected before triggering event