From 5cc9af5b310ecad0e12d80ea63d8657fd9a7f2cf Mon Sep 17 00:00:00 2001 From: "Albert R. Timashev" <695076+timashev@users.noreply.github.com> Date: Wed, 30 Jan 2019 23:23:52 +0530 Subject: [PATCH] fix(Modal): fix exception in focus management (#1382) * Fixes 'TypeError: t[(n - 1)] is undefined at [...].handleTab' JavaScript exception --- src/Modal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Modal.js b/src/Modal.js index 62aacbb57..01f5e9020 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -214,6 +214,7 @@ class Modal extends React.Component { const focusableChildren = this.getFocusableChildren(); const totalFocusable = focusableChildren.length; + if (totalFocusable === 0) return; const currentFocus = this.getFocusedChild(); let focusedIndex = 0;