WordPress.org

Make WordPress Core

Opened 6 weeks ago

#44329 new defect (bug)

current-menu-item class not applied to home link with starter content

Reported by: timph Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Menus Keywords:
Focuses: Cc:

Description

When viewing starter content in the customizer the home link does not get the current-menu-item class applied when you view the home page. The menu-item-object-{$type} class is also missing $type, so it just has the class menu-item-object- applied.

When viewing a customizer changeset of the starter content before actually publishing - the home link is not given the current-menu-item class as well. The menu-item-object-{$type} class is still missing $type in this class too.

After publishing the starter content the front end appears to have .current-menu-item correctly applied to the menu when navigating. However, when viewing the site in the customizer - the home link now always has the current-menu-item class applied regardless of which page you visit. This results in two links having current-menu-item applied ( the home link and the currently viewed link ). At this point the menu-item-object-{$type} class now has $type === 'custom', so the class menu-item-object-custom is properly applied.

Additional notes:

  • I was only testing with fresh wp installs.
  • I was using default permalink structure.
  • I noticed this issue with other themes that provide starter content, but it also happens with twentyseventeen
  • #43401 does not seem to fix the issues outlined in the steps below.

Expected results: I expected for menu items to have the current-menu-item classes properly applied when viewing changesets, the customizer preview would accurately reflect the frontend display, and that current-menu-item would not be applied to two different links when previewing pages in the customizer.

Steps to replicate:

  1. Use latest trunk (this does also occur on 4.9.6).
  2. Have fresh_site option set to 1 to get starter_content.
  3. Activate twentyseventeen theme.
  4. Go to customizer.
  5. Starter content should be populated - inspect the "Home" link which doesn't appear to have current-menu-item added, and has the incomplete class menu-item-object- as well.
  6. Click on one of the other pages - the link properly reflects the current-menu-item class.
  7. Save draft and open the changeset url provided.
  8. Click on one of the other pages other than home, and the same issue occurs.
  9. Go back into customizer, publish the changeset, and view the site now on the frontend. The home page link is now properly given current-menu-item, and menu-item-object-custom is correct.
  10. Click on one of the other links, and the home link no longer has current-menu-item applied, and is applied correctly to the new page you're on.
  11. Click on customize - once the customizer loads, the home link AND the link your were looking at both have current-menu-item applied, only the previewed page should have this class.

Change History (0)

Note: See TracTickets for help on using tickets.