Opened 11 years ago
Closed 11 years ago
#25594 closed defect (bug) (fixed)
When modifying your first menu, before saving, "Move" links do not work
Reported by: | ericlewis | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description
Before you have saved your first menu, a draft menu is populated for you to use with all the pages on your site. If you click on the dropdown arrow to open up one of these items (assuming your site has multiple pages), there are "Move" links - 'Up one,' 'Down one,' 'Under Test page,' 'To the top'. These links don't work, at least until you save the menu.
Attachments (2)
Change History (9)
#1
@
11 years ago
- Cc ankit.gade@… added
- Keywords has-patch added
In wp-admin/js/nav-menu.js file the events are attached to the element on "onclick" event. So evets are attched to the element when the page gets loaded, but not to the elements which are getting added to the document dynamically. So appropriate selector should be there, So instead of adding $("#element").on('click', function(){}) it should be $('body').on('click', "#element" function(){}). By doing this change it will work for all the targeted elements which are present or getting added dynamically after the page load.
#3
@
11 years ago
Yes, delegating the click
would work for all elements, initially loaded and added later. A bit better/faster way to do this would be to add one event handler and check the target:
$(document).on( 'click.move-menu', function( event ) { var $target = $( event.target ); if ( $target.hasCLass('menus-move-up') ) { ... } else if ( $target.hasCLass('menus-move-down') ) { ... } else if ( ... ) });
#4
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 26613:
#5
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
[26613] introduces 3 new jshint errors, 25594.jshint.diff fixes this.
Menu move jQuery patch