From 8a12d91925fd509554598c10fe8242cc28c30d2d Mon Sep 17 00:00:00 2001 From: Michael Roytman Date: Mon, 4 Dec 2017 10:29:07 -0500 Subject: [PATCH] fix(StatusAlert): Fix focus error for dismissible alert. (#89) StatusAlert requires a check for existence of xButton in componentDidUpdate to prevent errors when displaying dismissible alerts. --- src/StatusAlert/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StatusAlert/index.jsx b/src/StatusAlert/index.jsx index 411b8a7c36..11242b4642 100644 --- a/src/StatusAlert/index.jsx +++ b/src/StatusAlert/index.jsx @@ -32,7 +32,7 @@ class StatusAlert extends React.Component { } componentDidUpdate(prevState) { - if (this.state.open && !prevState.open) { + if (this.state.open && !prevState.open && this.xButton) { this.xButton.focus(); } }