[wp-trac] [WordPress Trac] #65348: Adding menu items in bulk, checked items forgotten when navigating

WordPress Trac noreply at wordpress.org
Wed May 27 09:50:39 UTC 2026


#65348: Adding menu items in bulk, checked items forgotten when navigating
--------------------------+---------------------------------------------
 Reporter:  daveykj       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  6.9.4
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:  ui, javascript, administration
--------------------------+---------------------------------------------

Comment (by yusufmudagal):

 Tested @ekamran's patch on PR 11977 and can confirm it addresses the
 reported issue.

 I was able to reproduce the issue on trunk: when selecting menu items in a
 paginated nav menu metabox, then navigating to another page of that
 metabox via AJAX pagination, the previous selections are lost because the
 metabox HTML is replaced and addSelectedToMenu() only reads currently
 checked inputs from the active panel.

 With @ekamran's patch applied, the targeted JS lint passes:

 {{{
 npm run grunt -- jshint:core --file=src/js/_enqueues/lib/nav-menu.js
 }}}

 Result: 1 file lint free.

 I also verified the changed behavior with a focused DOM regression check:
 - selections from page 1 are cached before the metabox markup is replaced
 - selections from a later page are combined with the cached selections
 - returning to a previously selected page restores the checked state
 - unchecking a restored item removes it from the cached selections
 - after adding items to the menu, the cache is cleared

 This looks like the right fix for the state-loss issue without changing
 the existing AJAX pagination flow.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65348#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list