Skip to content

Commit cb6504c

Browse files
lindskogendiasbruno
authored andcommitted
[fixed] Use bound ref functions
1 parent 7da6ec8 commit cb6504c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: src/components/ModalPortal.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ export default class ModalPortal extends Component {
9191
this.focusAfterRender = focus;
9292
}
9393

94+
setOverlayRef = (overlay) => {
95+
this.overlay = overlay;
96+
}
97+
98+
setContentRef = (content) => {
99+
this.content = content;
100+
}
101+
94102
afterClose = () => {
95103
focusManager.returnFocus();
96104
focusManager.teardownScopedFocus();
@@ -209,12 +217,12 @@ export default class ModalPortal extends Component {
209217

210218
return this.shouldBeClosed() ? <div /> : (
211219
<div
212-
ref={overlay => { this.overlay = overlay; }}
220+
ref={this.setOverlayRef}
213221
className={this.buildClassName('overlay', overlayClassName)}
214222
style={{ ...overlayStyles, ...this.props.style.overlay }}
215223
onClick={this.handleOverlayOnClick}>
216224
<div
217-
ref={content => { this.content = content; }}
225+
ref={this.setContentRef}
218226
style={{ ...contentStyles, ...this.props.style.content }}
219227
className={this.buildClassName('content', className)}
220228
tabIndex="-1"

0 commit comments

Comments
 (0)