Fixed selection when it's not visible

Fixed #2844

review: @devoncarew