Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi.
I must say that the classes that come menu.html.twig && menu-local-task.html seem to me quite redundant are can inhibit the productivity of some main-menu design tasks.
I woudl personally prefer edit the whole markup a new, after installing Basic... I thus suggest considering removing these two Twig files or at least removing this classes from them...
Ben.
Comments
Comment #2
Benia CreditAttribution: Benia commentedComment #3
joelpittetPersonally you can, this theme is meant to be a starter theme to implement your own design.
Which classes are you referring to though?
Comment #4
Benia CreditAttribution: Benia commentedSure, I know it's a starter theme, and originally I meant to:
'menu-item',
item.in_active_trail ? 'menu-item--active-trail',
And also:
.is-active
We can just edit via #id a or #id a:active and I think removing these classes could make the theme even more lightweight and minimal... But I might be very wrong in that conclusion.
Comment #5
joelpittetWhat's redundant about those classes? They are what's in Drupal 8 core and are BEM style so if you nested lists in your menu that you won't run into selector conflicts (think mega menus and things like that).
Also allows you to componentize your menu styles so that there is a consistent look. The #ids make things a bit set in stone for where you place things and should be avoided to keep things maintainable, IMO
Comment #6
leahtard CreditAttribution: leahtard at The Jibe commentedHi Benia,
Thanks for your issue -- we like cleanup the markup! I just don't see a way around needing these classes on the majority of projects. Styling
:active
is quite different than styling anis-active
ormenu-item--active-trail
class.:active
is only in place while the browser redirects. It is not aware of which page you are on likeis-active
.menu-item--active-trail
is helpful when you need a parent item to have a particular style.To be consistent, I would actually like to update
is-active
(SMACSS syntax) to usemenu-item--active
(BEM syntax) -- but I couldn't quite track down the best way to update this. It looks like core is adding this class via JS (core/misc/active-link.js).We are using BEM syntax which, yes, can be longer at times. Like Joel mentioned, Basic is intended to be a starter theme, not a base theme. The idea being you take Basic, rename it, and make it your own. After doing that, you can defiantly rename these classes in a way that fits your particular project.
Welcome any other feedback you might have.
Cheers, Leah
Comment #7
Benia CreditAttribution: Benia commentedAs I'm quite new to Drupal theming besides HTML-CSS, I didn't know much of these data. I no longer see these classes as redundant but I should master my work with them.
Much thanks!
Comment #8
leahtard CreditAttribution: leahtard at The Jibe commentedThanks Benia,
Don't hesitate to reach out with any other questions :)
Cheers, Leah