The single active menu link is marked with the class active. The trail from that item to the root of the menu should be similarly marked up with an active-trail class.

The styling of the active trail is still under design. Having the markup will at least allow us to style the links when the design is ready.

toolbar-active-trail.png

Comments

sjbassett’s picture

Screenshot of  active-trail classes in the DOM of the interactive menu

Patched the toolbar.js file to have jQuery find all li parents of the active link scoped to the `interactive-menu`. This is my first patch ever so any feedback on how I can do this better, please comment.

jQuery('.interactive-menu a.active').parents('.interactive-menu li').addClass('active-trail');

Status: Needs review » Needs work

The last submitted patch, 1827296-JS-adding-active-trail-class-01.patch, failed testing.

benjifisher’s picture

@sjbassett:

In order to make the test bot happy, you have to attach a patch against core. If you have your version of the code in the working tree, then this ought to do it:

$ git pull
$ git diff origin/8.x > 1827296-JS-adding-active-trail-class-04.patch

In order to make humans happy, do this *in addition to* the sort of patch you used in #1, but name it "...do-not-test.patch" so the test bot knows to ignore it.


No opinion on whether you found the right place to put the code.

Is there any difference in efficiency between .parents('.interactive-menu li') and (untested) .parentsUntil('.interactive-menu', 'li')?

We may also want PHP code to add the "active-trail" class in case JS is disabled. Or maybe I am being paranoid, and disabled JS is a problem of the past.

jessebeach’s picture

jessebeach’s picture

Status: Needs work » Closed (duplicate)