Android hw menu button cancel next event

Hello! I’m using the code below to implement the opening of the side menu when the Android hardware menu button is pressed. I got an odd behaviour I can’t debug. When I press the hardware menu button the menu opens, but the next event is canceled. For instance:

  1. Tap hw menu button -> the menu opens
  2. Tap a menu entry -> nothing happens
  3. Tap a menu entry -> works correctly

Even the hw menu botton is canceled like so:

  1. Tap hw menu button -> the menu opens
  2. Tap hw menu button -> nothing happens
  3. Tap hw menu button -> the menu closes

Any idea?

 .run(function($ionicPlatform, $ionicSideMenuDelegate) {
        $ionicPlatform.ready(function() {
          if (window.cordova) {
            document.addEventListener("menubutton", onHardwareMenuKeyDown);
          }
        });
    
        onHardwareMenuKeyDown = function () {
          $ionicSideMenuDelegate.toggleLeft();
        }
    })