Skip to content

Commit be1c81f

Browse files
authored
Merge pull request #266 from youda97/overflow-click
Fix(overflow menu): Click doesn't work in firefox and IE
2 parents 2e5d135 + 3e17662 commit be1c81f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/dialog/overflow-menu/overflow-menu-pane.component.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import { I18n } from "./../../i18n/i18n.module";
1919
#dialog
2020
class="bx--overflow-menu-options bx--overflow-menu-options--open"
2121
role="menu"
22-
(focusout)="clickClose($event)"
22+
(focusout)="menuClose($event)"
23+
(click)="doClose()"
2324
[attr.aria-label]="dialogConfig.menuLabel">
2425
<ng-template
2526
[ngTemplateOutlet]="dialogConfig.content"
@@ -110,14 +111,10 @@ export class OverflowMenuPane extends Dialog {
110111
}
111112
}
112113

113-
clickClose(event) {
114-
// Opens menu when clicking on the menu button and stays open while navigating through the options
115-
if (this.dialogConfig.parentRef.nativeElement.firstChild.contains(event.target) ||
116-
this.listItems().some(button => button === event.relatedTarget) ||
117-
event.type === "focusout" && event.relatedTarget === this.dialogConfig.parentRef.nativeElement) {
118-
return;
114+
menuClose(event) {
115+
if (this.listItems().some(button => button === document.activeElement)) {
116+
this.doClose();
119117
}
120-
this.doClose();
121118
}
122119

123120
protected listItems() {

0 commit comments

Comments
 (0)