Skip to content

Commit c33a479

Browse files
author
Renan Ferreira
committed
fix(react-dom): access iframe contentWindow instead of contentDocument
MDN has a list of methods for obtaining the window reference of an iframe: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Syntax
1 parent 103378b commit c33a479

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
@@ -44,10 +44,10 @@ function getActiveElementDeep() {
4444
let win = window;
4545
let element = getActiveElement();
4646
while (element instanceof win.HTMLIFrameElement) {
47-
// Accessing the contentDocument of a HTMLIframeElement can cause the browser
47+
// Accessing the contentWindow of a HTMLIframeElement can cause the browser
4848
// to throw, e.g. if it has a cross-origin src attribute
4949
try {
50-
win = element.contentDocument.defaultView;
50+
win = element.contentWindow;
5151
} catch (e) {
5252
return element;
5353
}

0 commit comments

Comments
 (0)