diff --git a/package.json b/package.json index 8e94016b6..6b27f0c85 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "immutable": "^3.8.1", "is-empty": "^1.0.0", "is-in-browser": "^1.1.3", + "is-window": "^1.0.2", "keycode": "^2.1.2", "prop-types": "^15.5.8", "react-portal": "^3.0.0", diff --git a/src/components/content.js b/src/components/content.js index 153b28c10..bcd4903c9 100644 --- a/src/components/content.js +++ b/src/components/content.js @@ -3,6 +3,7 @@ import Debug from 'debug' import React from 'react' import Types from 'prop-types' import getWindow from 'get-window' +import isWindow from 'is-window' import keycode from 'keycode' import TYPES from '../constants/types' @@ -825,7 +826,8 @@ class Content extends React.Component { * @param {Event} event */ - onWindowBlur = (e) => { + onWindowBlur = (event) => { + if (!isWindow(event.target)) return debug('onWindowBlur') this.tmp.isWindowFocused = false } @@ -836,7 +838,8 @@ class Content extends React.Component { * @param {Event} event */ - onWindowFocus = (e) => { + onWindowFocus = (event) => { + if (!isWindow(event.target)) return debug('onWindowFocus') this.tmp.isWindowFocused = true } diff --git a/yarn.lock b/yarn.lock index c483db2eb..65df5b720 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3374,6 +3374,10 @@ is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" +is-window@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d" + isarray@0.0.1, isarray@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"