Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#37575 closed defect (bug) (fixed)

Customizer Menus: css selector missing when adding custom link

Reported by: virgodesign's profile virgodesign Owned by: westonruter's profile westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch
Focuses: Cc:


While in customizer, if you are populating a navigation menu and you add a custom link to the menu, a new item is created and added with an initial wrong css selector.

Usually, when a user add a new item to a menu, the added item has the following css selector:

But when you add a custom link, the added item has the selector menu-item- instead of menu-item-custom.

This issue happens only during the creation of a custom link. All Previously created custom link items (loaded during customizer initialization) has the correct css selector: menu-item-custom.

This could appear as a not so important problem, but could brings to strange behaviour and style inconsistency.

Attachments (3)

css-custom-link.png (29.2 KB) - added by virgodesign 8 years ago.
Wrong CSS selector in custom link while in Menu customizer
37575.patch (440 bytes) - added by vishalkakadiya 8 years ago.
37575_1.patch (426 bytes) - added by vishalkakadiya 8 years ago.
This patch is valid

Download all attachments as: .zip

Change History (9)

8 years ago

Wrong CSS selector in custom link while in Menu customizer

8 years ago

This patch is valid

#1 @vishalkakadiya
8 years ago

Ok then quick review for Core Committers,

Checked customize-nav-menus.js Line no 1323
where we add class 'menu-item-' + settingValue.object, But the thing is that when custom menu link add to menu _submitLink() is called which is internally call submitLink()

Then in submitLink() there are one menuItem variable which 'object': '', but at that place we need to replace 'object': 'custom' sting in place of null string.

So that in 'menu-item-' + settingValue.object which will generate class name as menu-item-custom

Let me know if anything still needed.


Last edited 8 years ago by vishalkakadiya (previous) (diff)

#2 @vishalkakadiya
8 years ago

  • Keywords has-patch dev-feedback added

#3 @vishalkakadiya
8 years ago

  • Keywords dev-feedback removed

#4 @vishalkakadiya
8 years ago

  • Keywords dev-feedback added

#5 @westonruter
8 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 4.7
  • Owner set to westonruter
  • Status changed from new to accepted
  • Version changed from 4.5.3 to 4.3

#6 @westonruter
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 38301:

Customize: Ensure a newly-added custom link nav menu item has the appropriate CSS class names.

For nav menu items of the custom type, their object should also be set to custom, so that the menu-item-custom class name will be added.

Props vishalkakadiya.
Fixes #37575.

Note: See TracTickets for help on using tickets.