code: protected void cleanUpSubmenus(CmsChoiceMenuEntryWidget entryWidget) {
  
          CmsChoiceSubmenu submenu = entryWidget.getSubmenu();
          // First remove all submenus which are deeper than the submenu in which the current entry is located
          while (!m_submenus.isEmpty() && (getLastSubmenu() != submenu)) {
              removeSubmenu(getLastSubmenu());
          }
          // if it is a root entry, switch the attribute choice widget
          if (submenu == null) {
              CmsAttributeChoiceWidget choiceWidget = entryWidget.getAttributeChoiceWidget();
              if (choiceWidget != m_choice) {
                  closeAllChoices();
                  m_choice = choiceWidget;
              }
          }
      }
docs: Removes unnecessary submenus when the user hovers over a given menu entry.<p>
  
  @param entryWidget the menu entry over which the user is hovering