Skip to content

Commit d6cba84

Browse files
authored
fix(IE): Fix selection api on IE (#292)
See react-grid-layout/react-grid-layout#633
1 parent 65d3539 commit d6cba84

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/utils/domFns.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ export function addUserSelectStyles(doc: ?Document) {
150150
export function removeUserSelectStyles(doc: ?Document) {
151151
try {
152152
if (doc && doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
153-
window.getSelection().removeAllRanges(); // remove selection caused by scroll
153+
if (doc.selection) {
154+
// $FlowIgnore: IE
155+
doc.selection.empty();
156+
} else {
157+
window.getSelection().removeAllRanges(); // remove selection caused by scroll
158+
}
154159
} catch (e) {
155160
// probably IE
156161
}

0 commit comments

Comments
 (0)