Add null checking for document.activeElement

Detail is at  https://github.com/dataarts/dat.gui/issues/159
This commit is contained in:
finscn 2017-10-27 22:49:20 +08:00 committed by GitHub
parent 2659494a80
commit af88f4c712

View File

@ -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();
}