- Issue created by @G4MBINI
- π«π·France G4MBINI BΓ¨gles
@just_like_good_vibes I'll be happy to show you my issue with menus !
- First commit to issue fork.
- πΊπΈUnited States mortona2k Seattle
Loaded the menu.active_trail service to use getActiveTrailIds, and then $parameters->setActiveTrail().
- π«π·France Grimreaper France π«π·
Should it be done in the menu source or in the links prop type?
Currently the active trail is put as attribute in Links prop type, then I would say you play with that in your templates.
In UI Suite Bootstrap, I kind of follow what core does with either JS for authenticated user or event subscriber for anonymous users (need the companion module in π± [Discussion] blocked implementations and generic stuff Active )
- πΊπΈUnited States mortona2k Seattle
MenuSource is where the links are being loaded by MenuLinkTree->getMenuItems().
That's where I adjusted the parameters being passed in.
This is just like the default system menu block:
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/syste...I recall finding out that active links are not the same as active menu trail. The active tab/local task is a good example of where .is-active is used. But I think active menu trail classes are generated by the menu tree, and don't need the js for anonymous users.
- π«π·France Grimreaper France π«π·
Hello,
Stuff like item.in_active_trail is already possible.
When using a pattern with menu source. Active trail is present but not set properly.
Tested the MR and it fixes the issue.
Thanks.
Not merging because main UIP2 maintainers are now @just_like_good_vices and @christian.wiedemann, so maybe needs automated tests.
- Status changed to Needs work
about 1 month ago 8:43am 14 May 2025 - π«π·France Grimreaper France π«π·
Changing to needs work, Tests in tests/src/Kernel/Source/MenuSourceTest.php should be completed I think.
- π§πͺBelgium svendecabooter Gent
As reported in π [5.0.0-alpha3] Menu items do not get is-active class Active , this MR fixes the issue for me in ui_suite_daisyui for me, after adding some extra logic in the menu component of that theme.
I think having active menu items is pretty basic expected behaviour for a theme, so would be good to get this included sooner rather than later. Having to patch both a module and theme to get a visual indicator of the active menu item, isn't the best situation for getting adoption IMHO. Therefor I took the liberty to increase the priority of this issue. Feel free to lower priority if you disagree.
- π«π·France G4MBINI BΓ¨gles
This issue as been tested 2 times by @Grimreaper and @svendecabooter and only needs tests now ...
Do you think it could be added to 2.0.6 scope as it blocks some theme implementations ?
- π«π·France just_like_good_vibes PARIS
Hello,
just to add some information about the current implementation, i am questioning here the way it is done,
in comparison to the code inSystemMenuBlock::build
we could use
menuTree->getCurrentRouteMenuTreeParameters(
,
any thoughts?