Skip to content

Commit

Permalink
fix(OverflowMenu): fix <ClickOutside> not covering floating menu (car…
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh authored and tw15egan committed May 21, 2018
1 parent 37acad3 commit dddd7f6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ export default class OverflowMenu extends Component {
}
};

handleClickOutside = () => {
this.closeMenu();
handleClickOutside = evt => {
if (!this._menuBody || !this._menuBody.contains(evt.target)) {
this.closeMenu();
}
};

closeMenu = () => {
Expand All @@ -275,8 +277,11 @@ export default class OverflowMenu extends Component {
* @private
*/
_bindMenuBody = menuBody => {
if (!menuBody && this._hFocusIn) {
this._hFocusIn = this._hFocusIn.release();
if (!menuBody) {
this._menuBody = menuBody;
if (this._hFocusIn) {
this._hFocusIn = this._hFocusIn.release();
}
}
};

Expand All @@ -287,6 +292,7 @@ export default class OverflowMenu extends Component {
*/
_handlePlace = menuBody => {
if (menuBody) {
this._menuBody = menuBody;
(
menuBody.querySelector('[data-floating-menu-primary-focus]') || menuBody
).focus();
Expand Down

0 comments on commit dddd7f6

Please sign in to comment.