Skip to content

Commit 07a2753

Browse files
committed
[fixed] check if the modal content is available when async update... (#1)
It seems that the using redux, we can get a async update in which can fail when trying to focus the content of the modal. This should be a temporary fix since the issue is hard to reproduce, but safe for other applications.
1 parent cb6504c commit 07a2753

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/components/ModalPortal.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export default class ModalPortal extends Component {
130130
}
131131

132132
// Don't steal focus from inner elements
133-
focusContent = () => (!this.contentHasFocus()) && this.content.focus();
133+
focusContent = () =>
134+
(this.content && !this.contentHasFocus()) && this.content.focus();
134135

135136
closeWithTimeout = () => {
136137
const closesAt = Date.now() + this.props.closeTimeoutMS;

0 commit comments

Comments
 (0)