From af88f4c7126150cf81333d3da0b49738932ff4ed Mon Sep 17 00:00:00 2001 From: finscn Date: Fri, 27 Oct 2017 22:49:20 +0800 Subject: [PATCH] Add `null checking` for `document.activeElement` Detail is at https://github.com/dataarts/dat.gui/issues/159 --- src/dat/gui/GUI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index 803ee1b..a327452 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -468,7 +468,7 @@ GUI.TEXT_CLOSED = 'Close Controls'; GUI.TEXT_OPEN = 'Open Controls'; GUI._keydownHandler = function(e) { - if (document.activeElement.type !== 'text' && + if (document.activeElement && document.activeElement.type !== 'text' && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) { GUI.toggleHide(); }