Problem/Motivation
The main menu gets rendered as a "ui_suite_daisyui:menu" component, through menu--main.html.twig.
However, do to the logic in there, the menu item <a> elements do not automatically get the "is-active" class assigned to them, which does happen in Drupal core themes (probably through the "drupal.active-link" library).
It would make sense to have the active menu item be visually styled the same as when a menu item is hovered...
Steps to reproduce
- Add main menu block to a DaisyUI-powered theme
- Navigate to a page within the main menu
- Inspect the active menu item - it has no specific class to indicate it is the active item, nor any different visual style applied to it.
Proposed resolution
- Make sure the Drupal core "is-active" class gets correctly added to the active menu item
- Preferably, apply a different visual style to menu link items that have class "is-active".
Issue fork ui_suite_daisyui-3526471
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
svendecabooterComment #3
g4mbiniIt should be related to https://www.drupal.org/project/ui_patterns/issues/3508748
Comment #4
g4mbiniComment #5
svendecabooterI applied the MR logic from #3508748: Add ability to track active menu items in menu source.
Then in
ui_suite_daisyui:menucomponent, I add a check:That doesn't seem to work... Maybe I'm missing some additional context
Comment #6
svendecabooterI fixed this by applying the patch in #3508748: Add ability to track active menu items in menu source and adding the following to the
ui_suite_daisyui:menucomponent:Not sure if this logic can already be incorporated into ui_suite_daisyui, while waiting on its commit in ui_patterns.
It would be good to have this already in place by the time ui_patterns gets updated, but not sure what the policy is there...
Comment #7
g4mbini@svendecabooter thank you for your tests on these two related issues.
I would prefer to wait for UI Patterns upstream issue being fixed and move forward here.
Comment #8
g4mbiniComment #9
g4mbiniComment #10
g4mbiniComment #13
mortona2k commentedWorked on the UI Patterns issue, and added the class as recommended in #6.
Failing test is due to ui_skins_theme in ui_suite_daisyui.settings.yml.
Maybe it should be ui_skins.theme?
I think that's added here: https://git.drupalcode.org/project/ui_skins/-/blob/1.x/src/Hook/FormSyst...
Comment #14
mortona2k commentedNope, that didn't fix it. I'm not sure how the pipeline succeeded on the main branch.
Comment #16
just_like_good_vibesThanks @mortona2k, and @svendecabooter.
I rebased the MR on 5.0.x (please note that CI is fixed on 5.0.x now).
in_active_trail is part of the UI Patterns links schema since 2.0.20, so the theme now requires that version.
A parent with sub-items is shown as a collapsible summary, which our current daisyUI build does not highlight yet; it will once we rebuild with daisyUI 5.7.
Comment #18
just_like_good_vibes