#63059 closed defect (bug) (fixed)
JS Warning in navigation menus when removing an item
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 6.7 |
Component: | Menus | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
When removing an item from nav menus, an uncaught TypeError is thrown: "menus.updateParentDropdown is not a function". Thrown by the removeMenuItem
method, where it appears that the function is attached to the wrong object.
Introduced in [59265].
Milestoning for 6.7.3 if that occurs.
Change History (15)
This ticket was mentioned in PR #8464 on WordPress/wordpress-develop by @abcd95.
8 weeks ago
#3
- Keywords has-patch added; needs-patch removed
Trac ticket:
@audrasjb commented on PR #8464:
8 weeks ago
#4
Thanks, I tested the patch on my side and I can confirm it fixes the issue.
#7
@
8 weeks ago
- Keywords dev-feedback added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
Re-opening for 6.7.3, although that seems like a low probability milestone at this point.
#11
@
2 weeks ago
@phanduynam The status is right next to the ticket number at the top of the page. This has been closed for 5 weeks.
This ticket was mentioned in Slack in #core by sergey. View the logs.
2 weeks ago
#14
@
12 days ago
@jorbin closed but why do I still see it here?
https://core.trac.wordpress.org/tickets/minor
#15
@
12 days ago
.. because of the milestone, here you can see it's closed, but still marked as 6.7.3: https://core.trac.wordpress.org/milestone/6.7.3
Hi @joedolson and thanks for reporting this issue.
I think the problem occurs because, in nav-menu.js, the code is incorrectly calling the
updateParentDropdown()
andupdateOrderDropdown()
methods on the menus object instead of on the proper jQuery object.See here -
https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/lib/nav-menu.js#L1765
https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/lib/nav-menu.js#L1224
The fix is straightforward - we need to call these methods on the menu container object
($( '#menu-to-edit' ))
I'll submit a PR with this fix shortly which in my testing resolves the console errors.