From cb6504cfd99954acbc70ff358ab6b69332cff056 Mon Sep 17 00:00:00 2001 From: Johan Lindskogen Date: Sat, 17 Jun 2017 11:45:03 +0200 Subject: [PATCH] [fixed] Use bound ref functions --- src/components/ModalPortal.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js index fbf27a81..8d519838 100644 --- a/src/components/ModalPortal.js +++ b/src/components/ModalPortal.js @@ -91,6 +91,14 @@ export default class ModalPortal extends Component { this.focusAfterRender = focus; } + setOverlayRef = (overlay) => { + this.overlay = overlay; + } + + setContentRef = (content) => { + this.content = content; + } + afterClose = () => { focusManager.returnFocus(); focusManager.teardownScopedFocus(); @@ -209,12 +217,12 @@ export default class ModalPortal extends Component { return this.shouldBeClosed() ?
: (
{ this.overlay = overlay; }} + ref={this.setOverlayRef} className={this.buildClassName('overlay', overlayClassName)} style={{ ...overlayStyles, ...this.props.style.overlay }} onClick={this.handleOverlayOnClick}>
{ this.content = content; }} + ref={this.setContentRef} style={{ ...contentStyles, ...this.props.style.content }} className={this.buildClassName('content', className)} tabIndex="-1"