Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/component/selection/setDraftEditorSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind adding a failing test for the above and then adding your test which fixes it? That'd prevent a regression

//
// Added rangeCount check
// https://stackoverflow.com/questions/22935320/uncaught-indexsizeerror-failed-to-execute-getrangeat-on-selection-0-is-not
if (selection.rangeCount > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run into this before, legit error! Thanks for the pr! I'll bring it up and hopefully we can merge this in soonish

var range = selection.getRangeAt(0);
range.setEnd(node, offset);
selection.addRange(range.cloneRange());
}
}
}

Expand Down