From review at https://www.drupal.org/project/drupal/issues/3111409#comment-13841193

+++ b/core/themes/olivero/templates/navigation/menu--primary-menu.html.twig
@@ -0,0 +1,108 @@
+    <ul {{ attributes.addClass('primary-nav__menu', primary_nav_level) }}>

The primary-nav block element is missing.

CommentFileSizeAuthor
#6 3173829-6.patch484 bytesrahulrasgon
#3 3173829-2.patch2.63 KBjerseycheese

Comments

mherchel created an issue. See original summary.

jerseycheese’s picture

Assigned: Unassigned » jerseycheese
jerseycheese’s picture

Assigned: jerseycheese » Unassigned
Status: Active » Needs review
StatusFileSize
new2.63 KB

Here's a patch that adds the primary-nav class in the block wrapper, where the <nav> wrapper element is.

I think this is the ideal situation that follows existing convention of utilizing the <nav> wrappers in block templates, rather than adding cruft of a new wrapper block element added to the menu template (a <div>?).

We could do that instead if we want to keep the block element & class in the same template as the element/modifier classes, but adding it in the menu's complimentary block template seemed OK to me.

mherchel’s picture

Status: Needs review » Needs work

Yeah, adding it into the block element seems fine, but IMO it's a lot to create a new template just to add a single CSS class.

Is it possible to reuse this template and then add the class, or add the class via preprocess?

Thanks for working on this!

rahulrasgon’s picture

Assigned: Unassigned » rahulrasgon
rahulrasgon’s picture

Assigned: rahulrasgon » Unassigned
Status: Needs work » Needs review
StatusFileSize
new484 bytes

As #4
Please review the patch.
Thanks

  • mherchel committed b99e046 on 8.x-1.x authored by rahulrasgon
    Issue #3173829 by jerseycheese, rahulrasgon: Correct BEM classname...
mherchel’s picture

Status: Needs review » Fixed

#6 looks great! Committing. Thanks for the work on this!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.