Skip to content

Conversation

@LadySolveig
Copy link
Contributor

@LadySolveig LadySolveig commented Nov 22, 2025

Pull Request for Issue # .

Summary of Changes

Fix the menu toggle behavior based on the configurable start level.

Many thanks to @woluweb who reported this issue.

Testing Instructions

image image

Actual result BEFORE applying this Pull Request

The toggle for the submenu is missing when the `start level for the menu is set to > 1.

see also #46484 (comment)

grafik

Expected result AFTER applying this Pull Request

Works as expected also when the `start level for the menu is set to > 1.

grafik

see also #46484 (comment)

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@woluweb
Copy link
Contributor

woluweb commented Nov 23, 2025

I have tested this item ✅ successfully on 3b86864

I have tested this successfully.
Thank you so much Martina!

On these screenshots taken on https://www.healthybelgium.be/en/medical-practice-variations/medications, we have a side menu where Start Level = 2, the idea being to show a "dynamic contextual menu"

On the screenshot "before", we see that the submenu items of "Medications" is not visible (it is in the HTML though).
With this fix, wee see on the screenshot "after" that there is a "Caret" allowing to open the submenu items.

[ My only potential question would be: atm the Menu Item in question has a caret, but the latter is "closed" by default. What could one do, even with custom CSS or JS, to have it "opened" by default) ? ]

before

After


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46484.

@LadySolveig
Copy link
Contributor Author

@woluweb your welcome! Thank you for reporting this issue.

[ My only potential question would be: atm the Menu Item in question has a caret, but the latter is "closed" by default. What could one do, even with custom CSS or JS, to have it "opened" by default) ? ]

if you want the submenu items to be open by default when the parent menu item is the currently active, you can create a user.js in your template like this:

((document) => {

  document.addEventListener('DOMContentLoaded', () => {
    // mod-menu110 is the ID generated for the menu module that should behave this way
    // can also be replaces with a custom class set in the module settings
    const menuRoot = document.getElementById('mod-menu110');
    if (!menuRoot) {
      return;
    }

    const menuActiveLi = menuRoot.querySelector('li.current.active');
    if (!menuActiveLi) {
      return;
    }

    menuActiveLi.querySelector(':scope > [aria-expanded]')?.setAttribute('aria-expanded', 'true');

    const subLists = menuActiveLi.querySelectorAll('ul');
    subLists.forEach(subList => {
      subList.setAttribute('aria-hidden', 'false');
      subList.classList.add('show-menu');
    });
  });

})(document);

Then set the attribute for this to defer in joomla.asset.json. This file should also be in your template normally.
For Cassiopeia, for example, it would look like this:

grafik

It may also be useful to override the default.php so that it does not “jump” when the page is loaded.

I hope that helped. Happy coding :)

@LadySolveig LadySolveig marked this pull request as ready for review November 23, 2025 23:13
@LadySolveig LadySolveig requested a review from chmst as a code owner November 23, 2025 23:13
@woluweb
Copy link
Contributor

woluweb commented Nov 24, 2025

Txs @LadySolveig for the extra instructions about "how to have the submenu items opened by default".
Very detailed & clear !
And very much appreciated :)

@richard67 richard67 added the bug label Nov 24, 2025
@bembelimen
Copy link
Contributor

I have tested this item ✅ successfully on 3b86864


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46484.

@bembelimen
Copy link
Contributor

Set to RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46484.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 24, 2025
@Bodge-IT Bodge-IT merged commit e6577f1 into joomla:6.0-dev Dec 1, 2025
42 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Dec 1, 2025
@Bodge-IT
Copy link
Contributor

Bodge-IT commented Dec 1, 2025

Thank you @LadySolveig for fix, @woluweb for finding issue + test & @bembelimen for test

@richard67 richard67 added this to the Joomla! 6.0.2 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants