code: function handleDocumentKeyup(e) {
    // Cancel rect if Esc is pressed
    if (e.keyCode === 27) {
      let selection = window.getSelection();
      selection.removeAllRanges();
      if (overlay && overlay.parentNode) {
        overlay.parentNode.removeChild(overlay);
        overlay = null;
        document.removeEventListener('mousemove', handleDocumentMousemove);
      }
    }
  }
docs: Handle document.keyup event
  
  @param {Event} e The DOM event to handle