Opened 6 years ago
Last modified 5 years ago
#44329 reviewing defect (bug)
current-menu-item class not applied to home link with starter content
Reported by: | timph | Owned by: | audrasjb |
---|---|---|---|
Milestone: | Future Release | Priority: | low |
Severity: | normal | Version: | |
Component: | Menus | Keywords: | needs-patch |
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:
- Use latest trunk (this does also occur on 4.9.6).
- Have fresh_site option set to 1 to get starter_content.
- Activate twentyseventeen theme.
- Go to customizer.
- 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.
- Click on one of the other pages - the link properly reflects the current-menu-item class.
- Save draft and open the changeset url provided.
- Click on one of the other pages other than home, and the same issue occurs.
- 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.
- 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.
- 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.