treeview: more robust algorithm to detect click target