Repository: wagtail/wagtail

Issue:
Wagtail 2.16 - Slim Sidebar open only settings
### Issue Summary
When click on any menu item with submenu pages, the settings submenu always opens. 

### Steps to Reproduce

1. Open admin page
2. Click on any menu item with a submenu 
3. Settings submenu always opens

When click on the pages menu item, both submenus open. 

### Technical details

* Python version: 3.9.9.
* Django version: 3.2.12.
* Wagtail version: 2.16
* Browser version: firefox 96.0.3






Discussion:
Hi @niakriss67 - thanks for the report. However, I'm unable to replicate this on a fresh installation of [bakerydemo](https://github.com/wagtail/bakerydemo/) (with requirements/base.txt updated to `wagtail>=2.16,<2.17`).
It is very good that everything works on a clean installation of your specific assembly. But you didn't write anywhere that version 2.16 is incompatible with previous versions. Rollback to 2.15.3 fixes this problem. 
If you can find a sequence of steps that independently replicates the issue (perhaps involving creating a project under 2.15 then upgrading) then we'll be happy to investigate further - however, if it only happens on a single project then there's no way for us to determine whether it's a legitimate bug, a customisation within that project, or user error.

Often, issues with upgrading can be caused by stale JS files from the previous version being cached in the browser (or, on a production site, failing to re-run `./manage.py collectstatic`).
1. You need to create a new module.
2. Create three submenu links with ModelAdmin. Specify some models.
3. Add a group with these links. The link name must be in Cyrillic! For example, menu_label = "Опросы"
4. Register a group with modeladmin_register.

Those. the error appears when the link name is not written in English. I checked with another language besides Cyrillic. 

In version 2.15.3, all languages in links work fine.
The same error appears even without a new module. It is enough to add another localization to the settings. LANGUAGE_CODE = 'ru-ru'. Then the settings submenu appears everywhere, as the last one in the list in Russian. 
Thanks for the additional detail - I can confirm that I'm seeing the same issue on bakerydemo when set to `LANGUAGE_CODE = 'ru'`.

The issue is that Django's `slugify` function is being used to generate an ID from the label, and on non-Latin alphabets this results in an empty string, causing all menu items to have the same ID. I'll open a PR to fix this now.

Resolving patch:
diff --git a/wagtail/admin/menu.py b/wagtail/admin/menu.py
--- a/wagtail/admin/menu.py
+++ b/wagtail/admin/menu.py
@@ -2,11 +2,11 @@
 from django.forms.utils import flatatt
 from django.template.loader import render_to_string
 from django.utils.safestring import mark_safe
-from django.utils.text import slugify
 
 from wagtail.admin.ui.sidebar import LinkMenuItem as LinkMenuItemComponent
 from wagtail.admin.ui.sidebar import SubMenuItem as SubMenuItemComponent
 from wagtail.core import hooks
+from wagtail.core.utils import cautious_slugify
 
 
 class MenuItem(metaclass=MediaDefiningClass):
@@ -17,7 +17,7 @@ def __init__(self, label, url, name=None, classnames='', icon_name='', attrs=Non
         self.url = url
         self.classnames = classnames
         self.icon_name = icon_name
-        self.name = (name or slugify(str(label)))
+        self.name = (name or cautious_slugify(str(label)))
         self.order = order
 
         if attrs:


Test patch: