diff --git a/cypress/integration/examples/iframe.ts b/cypress/integration/examples/iframe.ts index ddeddc9ac0..887029030c 100644 --- a/cypress/integration/examples/iframe.ts +++ b/cypress/integration/examples/iframe.ts @@ -12,6 +12,7 @@ const getIframeBody = () => { .its('body') // automatically retries until body is loaded .should('not.be.undefined') + .should('not.be.null') .then(cy.wrap) ) } diff --git a/site/examples/iframe.tsx b/site/examples/iframe.tsx index e6cd922b4b..7898633755 100644 --- a/site/examples/iframe.tsx +++ b/site/examples/iframe.tsx @@ -105,14 +105,13 @@ const MarkButton = ({ format, icon }) => { } const IFrame = ({ children, ...props }) => { - const [contentRef, setContentRef] = useState(null) - const mountNode = - contentRef && - contentRef.contentWindow && - contentRef.contentWindow.document.body + const [iframeBody, setIframeBody] = useState(null) + const handleLoad = e => { + setIframeBody(e.target.contentDocument.body) + } return ( - ) }