diff --git a/src/component/selection/setDraftEditorSelection.js b/src/component/selection/setDraftEditorSelection.js index 98a79aee2e..18a74af76e 100644 --- a/src/component/selection/setDraftEditorSelection.js +++ b/src/component/selection/setDraftEditorSelection.js @@ -303,9 +303,14 @@ function addFocusToSelection( // Additionally, clone the selection range. IE11 throws an // InvalidStateError when attempting to access selection properties // after the range is detached. - var range = selection.getRangeAt(0); - range.setEnd(node, offset); - selection.addRange(range.cloneRange()); + // + // Added rangeCount check + // https://stackoverflow.com/questions/22935320/uncaught-indexsizeerror-failed-to-execute-getrangeat-on-selection-0-is-not + if (selection.rangeCount > 0) { + var range = selection.getRangeAt(0); + range.setEnd(node, offset); + selection.addRange(range.cloneRange()); + } } }