     # Mark this highlight as deselected
     @_$highlight.removeClass 'selected'
 
+    # First store any selection which is outside pages
+    otherRanges = []
+    selection = rangy.getSelection()
+    for r in [0...selection.rangeCount]
+      range = selection.getRangeAt r
+      otherRanges.push range unless $(range.commonAncestorContainer).closest('.display-page').length
+
     # Deselect everything
-    selection = window.getSelection()
     selection.removeAllRanges()
 
     # We will re-add it in highlight.select() if necessary


    # And re-select highlights marked as selected
    highlight.select() for highlight in @anchor.annotator.getHighlights() when highlight.isSelected()

    # If mouse is not over the highlight we unhover
    @unhover true unless @_mouseHovering


  # Just a helper function to draw highlight selected and make it selected by the browser, use annotator._selectHighlight to select
  select: =>
    selection = rangy.getSelection()
    selection.addRange @normedRange.toRange()

    @_$selectionLayer.addClass 'highlight-selected'
