Moving a nested menu item via the link edit form or node edit form does not update menu of the children

Created on 20 March 2018, over 6 years ago
Updated 30 January 2023, over 1 year ago

Apologies if this has already been captured somewhere else. I did a search on the issue queue but couldn't see anything as explicitly stated as this... Though I find it hard to believe that nobody has encountered this issue before. Feel free to close as a duplicate if this is the case. The most similar issue I could find (for D7) has been linked.

Problem/Motivation

When a menu item with nested children is moved from one menu to the other... Those children items' menu settings are NOT updated. The child links appear in the new menu, but the menu link edit and node edit forms do not reflect this so any update will result in the link being moved to the root of the original menu.Steps to reproduce

  1. Create a https://simplytest.me/ instance for Drupal core 8.4 dev (plus the devel module to speed up bulk creation of test content)
  2. Enable the 'Devel generate' module (/admin/modules)
  3. Mass create 50 'Basic page' nodes (/admin/config/development/generate/content)
  4. Edit the main menu and add a number of these nodes (make sure some are nested as children at least 2 levels deep)
  5. Create a new menu (/admin/structure/menu/add)
  6. Make sure that newly created menu is selected for the 'Basic page' content type (/admin/structure/types/manage/page)
  7. Edit any parent node at least 1 level deep with nested children, either within the menu link edit form or the node edit form
  8. Change the menu parent item for that node to be at the root of the newly created menu (under 'Menu settings')
  9. Visit the newly created menu admin page and verify that the parent/children menu items are present (all moved across from the above step)
  10. Edit any of the children items. The 'Parent link' field is now automatically set to the root of the main menu. The same is true if you edit that child node... More problematic is that saving it will move the item back into the main menu when in fact it should stay in the new menu
  11. Saving the menu structure from the admin page doesn't seem to make a difference

Proposed resolution

Ideally when a menu item is moved; the children menu item node/s should be updated accordingly. If this is not possible then a warning message should at least be displayed to the user letting them know of this limitation. Otherwise if a user follows the instructions above and then edits a child menu item; they will unintentionally move the menu item back to the root of the 'Main menu'.

Remaining tasks

Implement fix as per 'Proposed resolution' if simple enough to do so. Otherwise have a discussion about the best way to tackle this problem.

User interface changes

Unsure

API changes

Unsure but unlikely

Data model changes

Unsure

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
Menu systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¦πŸ‡ΊAustralia marc.groth

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.71.5 2024