From 2748c4258687acc60b091235644c484ac925a20b Mon Sep 17 00:00:00 2001 From: David Niederweis Date: Mon, 27 Jun 2022 10:51:40 -0700 Subject: [PATCH 1/2] replace usage of findDOMNode with creating selfRef in constructor --- components/modal/index.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/modal/index.jsx b/components/modal/index.jsx index 9aa58b1453..82a07abe33 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -207,6 +207,8 @@ class Modal extends React.Component { if (props.ariaHideApp) { checkAppElementIsSet(); } + + this.selfRef = React.createRef(); } componentDidMount() { @@ -224,14 +226,14 @@ class Modal extends React.Component { // and manager.jsx are removed. They appear to have // been created in order to do modals in portals. if (!this.isUnmounting) { - const el = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node + // const el = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node if ( - el && - el.parentNode && - el.parentNode.getAttribute('data-slds-modal') + this.selfRef && + this.selfRef.parentNode && + this.selfRef.parentNode.getAttribute('data-slds-modal') ) { - ReactDOM.unmountComponentAtNode(el); - document.body.removeChild(el); + ReactDOM.unmountComponentAtNode(this.selfRef); + document.body.removeChild(this.selfRef); } } } From 845b07bdacc3a5cae1456015d169fe778efb0497 Mon Sep 17 00:00:00 2001 From: David Niederweis Date: Mon, 27 Jun 2022 11:07:14 -0700 Subject: [PATCH 2/2] deleted findDOMNode that was commented out for testing --- components/modal/index.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/modal/index.jsx b/components/modal/index.jsx index 82a07abe33..77ed230151 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -226,7 +226,6 @@ class Modal extends React.Component { // and manager.jsx are removed. They appear to have // been created in order to do modals in portals. if (!this.isUnmounting) { - // const el = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node if ( this.selfRef && this.selfRef.parentNode &&