Skip to content

Commit

Permalink
[fixed] Use bound ref functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lindskogen authored and diasbruno committed Jun 20, 2017
1 parent 7da6ec8 commit cb6504c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -209,12 +217,12 @@ export default class ModalPortal extends Component {

return this.shouldBeClosed() ? <div /> : (
<div
ref={overlay => { this.overlay = overlay; }}
ref={this.setOverlayRef}
className={this.buildClassName('overlay', overlayClassName)}
style={{ ...overlayStyles, ...this.props.style.overlay }}
onClick={this.handleOverlayOnClick}>
<div
ref={content => { this.content = content; }}
ref={this.setContentRef}
style={{ ...contentStyles, ...this.props.style.content }}
className={this.buildClassName('content', className)}
tabIndex="-1"
Expand Down

0 comments on commit cb6504c

Please sign in to comment.