Hello all.
I built myself a custom component (com_medialibrary
) and have it installed and running on Joomla 5. One odd thing I noticed is that multiple menu items in the main sidebar menu get highlighted as "active" despite me only viewing the Items view of my custom Media Library component.
See some screenshots below to help show what I am trying to explain...
Unsure why both menu items are marked as "active".
Now here only the single menu item is properly marked as "active".
After navigating to the custom Media Library component Items view menu item, only com_medialibrary Items view menu item (/administrator/index.php?option=com_medialibrary
) gets the mm-active
class applied to it.
After navigating to the custom Media Library component Items view menu item, both com_media default view menu item (administrator/index.php?option=com_media&path=local-images:/
) and com_medialibrary Items view menu item (/administrator/index.php?option=com_medialibrary
) get the mm-active
class applied to both of them.
I believe the "issue" to be related to the foreach if condition that begins on/around line 56 of media/mod_menu/js/admin-menu.js
but I am not sure how exactly the admin menu works...
if (!link.href.match(/index\.php$/) && currentUrl.indexOf(link.href) === 0 || link.href.match(/index\.php$/) && currentUrl.match(/index\.php$/)) {
As if the Javascript code is incorrectly matching the URL strings.
This behavior only happens when I navigate to Components > Media Library > Items view (/administrator/index.php?option=com_medialibrary
)
If I navigate to Content > Media (administrator/index.php?option=com_media&path=local-images:/
) then only the Content > Media menu item gets the mm-active
class applied, not the menu item in my custom component.
Any thoughts?
Labels |
Added:
No Code Attached Yet
|
Similar effect here #35228 (comment) and #43907 (comment)