Skip to content

Commit 174375c

Browse files
committed
Prevent restoreSelection overwriting active element
1 parent b3998eb commit 174375c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-dom/src/client/ReactInputSelection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function getElementsWithSelections(acc, win) {
4545
return acc;
4646
}
4747
let element = getActiveElement(doc);
48-
// Use getSelection if no activeElement with selection capabilities
49-
if (!hasSelectionCapabilities(element)) {
48+
// Use getSelection if activeElement is the document body
49+
if (element === doc.body) {
5050
if (win.getSelection) {
5151
const selection = win.getSelection();
5252
if (selection) {

0 commit comments

Comments
 (0)