Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30722 closed enhancement (fixed)

Twenty Fifteen: Keep sub-menus open when visiting sub-menu pages

Reported by: zoonini's profile zoonini Owned by: lancewillett's profile lancewillett
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: Bundled Theme Keywords: has-patch needs-testing needs-refresh
Focuses: Cc:

Description

A WordPress.com user who's been using Twenty Fifteen noticed that it becomes a bit cumbersome to keep re-opening a sub-menu.

To replicate:

  1. Create a primary menu with sub-menu items, either through the default or custom menu
  2. Visit the site on the front end and click the top-level menu item
  3. Click a sub-menu item
  4. Note how you need to click the top-level menu item again if you want to visit another sub-menu page in the same section

It would save some user clicks to keep the sub-menu open after it's been first clicked.

As the user puts it:

The problem is that once the user selects one of these nested items and navigates to the page, the nested menu closes again, meaning that the user has to re-click on the parent item over and over again to keep opening up the nested menu to view what other pages are under it. As you can imagine, this becomes very annoying for the user very quickly. Is there any way to customize the menu so that the nested list will stay open as long as the user is on a page that is nested under the same parent item?

Suggested in this forum thread.

Attachments (4)

30722.diff (471 bytes) - added by jartes 10 years ago.
30722.1.patch (1.3 KB) - added by jartes 10 years ago.
30722.1.diff (1.3 KB) - added by jartes 10 years ago.
30722.2.diff (849 bytes) - added by jartes 10 years ago.

Download all attachments as: .zip

Change History (15)

#1 @iamtakashi
10 years ago

  • Version changed from 4.0.1 to trunk

It could be a good enhancement but for the next update since we are so close to the initial release.

@jartes
10 years ago

#2 @jartes
10 years ago

  • Keywords has-patch added

Just display the sub-menu for menu items that has .current_page_ancestor class.

#3 @lancewillett
10 years ago

Patch is good start. I think it also needs .current-menu-ancestor selector as well, to cover both fallback menu (pages) and custom menu.

#4 @iamtakashi
10 years ago

Twenty Fifteen doesn't have the fallback page navigation so it should be fine with using just .current-menu-ancestor.

#5 @lancewillett
10 years ago

  • Keywords early added
  • Milestone changed from Awaiting Review to Future Release

@jartes
10 years ago

#6 @jartes
10 years ago

In 30722.1.diff all the work now it’s made with javascript as we need to add ‘toggle’ classes to open submenus.

Also added proper 'font-weight' for .current-menu-ancestor items

Last edited 10 years ago by jartes (previous) (diff)

@jartes
10 years ago

#7 @iamtakashi
10 years ago

  • Milestone changed from Future Release to 4.2

#8 @iandstewart
10 years ago

  • Keywords needs-testing added; early removed

#9 @lancewillett
10 years ago

  • Keywords needs-refresh added

I wasn't able to cleanly apply the patch -- jartes can you please refresh your patch with latest version of the theme in trunk?

@jartes
10 years ago

#10 @jartes
10 years ago

Added refreshed patch :)

#11 @lancewillett
10 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 31214:

Twenty Fifteen: keep sub-menus open when visiting sub-menu pages, to show context when navigating a site.

Props jartes, fixes #30722.

Note: See TracTickets for help on using tickets.