Skip to content

Commit

Permalink
fix(button-menu): ensure button menu closes when tabbed away (#549)
Browse files Browse the repository at this point in the history
`this.mq` is a string, `this.mql` is a `MediaQueryList` which has a matches method, as was
originally intended
  • Loading branch information
gregtyler committed Jan 24, 2024
1 parent ca8f390 commit b223d40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/moj/components/button-menu/button-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ MOJFrontend.ButtonMenu.prototype.onButtonKeydown = function(e) {
this.focusNext(e.currentTarget);
break;
case this.keys.esc:
if(!this.mq.matches) {
if(!this.mql.matches) {
this.menuButton.focus();
this.hideMenu();
}
break;
case this.keys.tab:
if(!this.mq.matches) {
if(!this.mql.matches) {
this.hideMenu();
}
}
Expand All @@ -152,4 +152,4 @@ MOJFrontend.ButtonMenu.prototype.focusPrevious = function(currentButton) {
} else {
this.container.find('[role=menuitem]').last().focus();
}
};
};

0 comments on commit b223d40

Please sign in to comment.