I have a navigation menu showing in both the header and footer of my site both of which are for the main navigation and are added via Blocks Layout.

In the live Drupal 8 environment the active and active trail classes work as expected for authenticated user and non-authenticated user but the resulting static html files all have the same menu item marked as the active item despite not being the correct page.

i.e. if I have Frontpage, Page A, Page B and Page C. Pages A, B and C all have menu items, frontpage does not. From the static files, frontpage shows no active menu items as expected. However whichever of the other pages you visit, Page B always gets the active class.

CommentFileSizeAuthor
#6 3024444-6.patch2.77 KBsamuel.mortenson

Comments

jamestamr created an issue. See original summary.

samuel.mortenson’s picture

Thanks for the issue @jamestamr! This is an unfortunate side-effect of a performance enhancement Tome uses to process multiple requests in one Drupal bootstrap. When you run drush tome:static it spawns five processes, with each process handling five requests. Drupal isn't totally designed to handle multiple requests in one bootstrap/process so I've had to work through a few bugs like this as they come in.

I've replicated this bug but don't have a solution yet - in the meantime you can run drush tome:static --path-count=1, which in my testing avoids this problem and properly adds the active trail class to menu items.

jamestombs’s picture

Not been able to get tome drush commands to work, only been able to run through UI.

$ drush tome:static
The drush command 'tome:static' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.

Drush version: 8.1.18

samuel.mortenson’s picture

@jamestamr Drush 9 is required to run Tome commands.

jamestombs’s picture

Perfect thanks.

samuel.mortenson’s picture

Status: Active » Needs review
StatusFileSize
new2.77 KB

Here's a patch which should fix this problem. @jamestamr if you have time to test it out when using the user interface I'd appreciate it!

  • samuel.mortenson authored 94937a7 on 8.x-1.x
    Issue #3024444 by samuel.mortenson: Menu active trail stays the same for...
samuel.mortenson’s picture

Status: Needs review » Fixed

It's been awhile so I'm just going to commit - thanks!

Status: Fixed » Closed (fixed)

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