Skip to content

Commit

Permalink
Prevent restoreSelection overwriting active element
Browse files Browse the repository at this point in the history
  • Loading branch information
acusti committed Nov 17, 2017
1 parent b3998eb commit 174375c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/ReactInputSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function getElementsWithSelections(acc, win) {
return acc;
}
let element = getActiveElement(doc);
// Use getSelection if no activeElement with selection capabilities
if (!hasSelectionCapabilities(element)) {
// Use getSelection if activeElement is the document body
if (element === doc.body) {
if (win.getSelection) {
const selection = win.getSelection();
if (selection) {
Expand Down

0 comments on commit 174375c

Please sign in to comment.