From 174375cf24cda80d3fe7da3573472d015434c870 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 17 Nov 2017 07:28:33 -0800 Subject: [PATCH] Prevent restoreSelection overwriting active element --- packages/react-dom/src/client/ReactInputSelection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-dom/src/client/ReactInputSelection.js b/packages/react-dom/src/client/ReactInputSelection.js index f214ddf0ab8f2..267e41737e35b 100644 --- a/packages/react-dom/src/client/ReactInputSelection.js +++ b/packages/react-dom/src/client/ReactInputSelection.js @@ -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) {