Skip to content

Commit

Permalink
Adding blur event to window to access activeElement | Fixes liferay…
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemsteles committed May 30, 2018
1 parent 0754d60 commit 0608afe
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/clay-dropdown/src/ClayDropdownBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ class ClayDropdownBase extends ClayComponent {
});
}

/**
* Handles blur window in order to hide menu.
* @private
*/
_handleWinBlur() {
const activeElement = document.activeElement;
if (activeElement != null && activeElement.nodeName === 'IFRAME') {
this._close();
}
}

/**
* @inheritDoc
*/
Expand All @@ -225,7 +236,8 @@ class ClayDropdownBase extends ClayComponent {
'touchend',
this._handleDocClick.bind(this),
true
)
),
dom.on(window, 'blur', this._handleWinBlur.bind(this), true)
);
}
}
Expand Down

0 comments on commit 0608afe

Please sign in to comment.