prevent selected node/table item from being out of viewport