[6.0] Fix deep submenu display
Summary of Changes
After https://github.com/joomla/joomla-cms/pull/45352 is merged, more issues with the menu can be fixed. This PR now fixes two issues:
- When there are more than two levels of menu items in the backend, the deeper levels has no correct padding
- When one of the sub-levels are opened there is a JS error and after refreshing the page the menu does not stay open
Testing Instructions
This is a bit tricky, as we have to kind of fake a deep hierarchy in the backend. So either create your own custom backend menu or we use a little trick to inject a deeper hierachy:
- Open
administrator/modules/mod_menu/src/Menu/CssMenu.php - Add the following code after line 423:
elseif ($item->element === 'com_contact' && isset($query['view']) && $query['view'] === 'contacts') {
MenusHelper::loadPreset('content', false, $item);
}
This will load the content menu below the com_contact menu.
Actual result BEFORE applying this Pull Request
- When opening the deep hierarchy, a JS error is thrown:
- After refreshing the page, the selected active menu item is not opened
- Styling is not correct
Expected result AFTER applying this Pull Request
- No JS error
- Active menu item is visible
- Styling is correct
Link to documentations
Please select:
-
[ ] Documentation link for docs.joomla.org:
-
[x] No documentation changes for docs.joomla.org needed
-
[ ] Pull Request link for manual.joomla.org:
-
[x] No documentation changes for manual.joomla.org needed
Hi @bembelimen, I have the BEFORE condition (including the JS console error and incorrect styling), after placing that code after line 423, but I have the standard design for that area and not what you show in your AFTER image - the good news there is NO JS console error which I have in the BEFORE situation once the PR is applied - so I think that I should show you:
I have tested this item :white_check_mark: successfully on 88074e3cd1177ee215b520ff2df7051e1d81f517
I have tested this successfully. Thanks @bembelimen for the work!
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46550.
I have tested this item :white_check_mark: successfully on b7c7358cb088a6a7bb24fc5bdb8bcd6368da9b4b
replicated the problem with a custom admin menu and confirmed the fix
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46550.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46550.