testSpaceOrEnterClosesMenu() {
    const node = dom.getElement('demoMenuButton');
    menuButton.decorate(node);

    menuButton.setOpen(true);
    menuButton.handleKeyEvent(new MyFakeEvent(KeyCodes.ENTER));
    assertFalse('Menu should close after pressing Enter', menuButton.isOpen());

    menuButton.setOpen(true);
    menuButton.handleKeyEvent(new MyFakeEvent(KeyCodes.SPACE, EventType.KEYUP));
    assertFalse('Menu should close after pressing Space', menuButton.isOpen());
  }
Tests the behavior of the enter and space keys when the menu is open.
     @suppress {checkTypes} suppression added to enable type checking