Problem/Motivation

  • The interface is simpler.
  • The functionality provided is not very helpful. The majority of users have no idea of the weight assigned to other menu items. This is a frustrating experience for users and a definite "DrupalWTF". Drag and drop menus are an intuitive experience.
  • Weight has been removed from other user facing systems. Are there any other areas of core that still show a weight selector like this?
  • The change is consistent with blocks. You can not set the weight of a block under its configuration page.

Steps to reproduce

Proposed resolution

Removes weight from the user interface for adding/editing menu items

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-491022

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexanderpas’s picture

if you disable javascript, you'll see the weight secectors coming back in core.

yet, +1 for UI synching with blocks, on overview
not sure about the node/add chance

Status: Needs review » Needs work

The last submitted patch failed testing.

sun’s picture

dodorama’s picture

I like the idea of removing the weight selector from content creation form. It's not that useful, as it is.

rickvug’s picture

Version: 7.x-dev » 8.x-dev

Unfortunately at this point I think this is D8 material.

Bojhan’s picture

Can we get a reroll? I would definitely favor this, I have not seen one participant in all the testing we have done understand the effects of this feature.

idflood’s picture

Status: Needs work » Needs review
FileSize
1.39 KB

I like the idea, but I think it would be better to keep the form item and only change it to a "hidden" type. This way modules can still use and change this value (I've created a module that does just that).

Here is a patch based on the first one but using "hidden" type.

Status: Needs review » Needs work

The last submitted patch, remove_menu_weight-491022-7.patch, failed testing.

Sivaji_Ganesh_Jojodae’s picture

Status: Needs work » Needs review
FileSize
2.32 KB

+1 for removing.

Rerolled version of rickvug's patch from branch 8.x with test case modification.

Status: Needs review » Needs work

The last submitted patch, remove_menu_weight-491022-9.patch, failed testing.

Sivaji_Ganesh_Jojodae’s picture

Status: Needs work » Needs review
FileSize
2.13 KB

Changed weight type to value in function menu_edit_item().

Status: Needs review » Needs work

The last submitted patch, remove_menu_weight-491022-11.patch, failed testing.

idflood’s picture

Status: Needs work » Needs review
FileSize
1.88 KB

I've checked the failing test of the patch posted in #7. It was caused by assertOptionSelected, changing that to assertFieldByName seems to make the test pass. I've also switched back to #default_value instead of #value.

nod_’s picture

Status: Needs review » Needs work

need reroll.

idflood’s picture

Status: Needs work » Needs review
FileSize
1.45 KB

Here is a quick reroll. I'm not sure there is still something to modify in the test file so let's see what the testbot will tell.

nod_’s picture

if tests are ok that's RTBC for me.

Status: Needs review » Needs work

The last submitted patch, remove_menu_weight-491022-15.patch, failed testing.

idflood’s picture

My bad, eventually there was something to change in the test. Bot should be happier now.

idflood’s picture

Status: Needs work » Needs review
nod_’s picture

Status: Needs review » Reviewed & tested by the community

still working.

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs accessibility review

We need to check this for accessibility, because obviously people who cannot see cannot use the drag and drop interface.

webchick’s picture

Specifically, I mean the menu.admin.inc hunk. Removing it from the node form is consistent with taxonomy terms, as nod_ pointed out in IRC. However, removing it from the admin form creates inconsistency w/ taxonomy terms, for example.

Everett Zufelt’s picture

I didn't read through the entire issue.

I agree that removing the weight from the node form is a great idea, it's useless there. If the proposal is also to remove weight from the individual menu item edit pages then that is fine as well (how do you know looking at a single item what the weight should be).

If the proposal is to also remove weight from the menu item listing UI then I question how menu items will be reordered. If this is not part of the proposal then RTBC.

nod_’s picture

Yes the table with show row weight/hide row weights will still be available.

sun’s picture

Hm. When doing this an related removals, then we should create a major follow-up to "fix" the tableDrag JS to "try hard to leave weights of other things in the table alone when dragging an item."

That is, because there are often situations in which only a single item is being moved within others. When doing that in tableDrag, then the weights of all other items that were "crossed" are changed, whereas only a single one was dragged.

Thus, doing so will cause an update to all the items for which the weight was manipulated. Especially for things that live in configuration, this will cause all config objects to be rewritten and changed for the new weights - and in turn, you will see differences for many config objects that need to be staged, even though only a single one was edited.

A typical way to address that is to make tableDrag use larger "gaps" between the weight steps it assigns (i.e., instead of reordering weights into 1,2,3 they should be reordered into 10,20,30). Thus, when another or a new item is later moved in between other items, then the chance for having to adjust surrounding weights significantly decreases, and if it happens, then only one of the direct siblings has to be adjusted.

Lastly, and this is probably a much larger problem than the tableDrag weight issue above:

What if not all items within an hierarchy can be shown on a single administrative page for reordering? AFAIK, this problem existed for menu links in earlier versions, and the only fix we were able to apply was to load all items on a single page (regardless of whether there might be 3,000 of them in a single tree). -- What I'm after is: With the weight element on an individual item, you are able to go into another item to check its weight, go back to the item you want to move, and fill in a similar weight.

I'm not trying to say that we shouldn't do this change, but instead I'd like to make sure that we are addressing all of the consequences of removing the weight selector here (and possibly elsewhere). I think the two issues I outlined above should at least be major tasks in case this lands.

mgifford’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

I'm not sure what the accessibility implications of this are, but the patch no longer applies.

superspring’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.51 KB

Same patch, rerolled.

mgifford’s picture

Where do I go to test this patch? I thought it would be admin/structure/menu/manage/admin/add

A screenshot would be great too.

pwolanin’s picture

Status: Postponed » Needs review
mgifford’s picture

Seems like there's no reason to leave this as postponed.

Status: Needs review » Needs work

The last submitted patch, 27: remove_menu_weight-491022-27.patch, failed testing.

sirtet’s picture

I totally disagree with simply removing the weight field!
Yes, the current state IS a Drupal WTF, but the proposed "fix" would still leave a smaller one.
It will be like saying:

Yes we are unable to create a UI where a user can create (and position) a menu item in one step.

Currently, that's also not possible, as about noone will know what value to use for weight, unless they visited the menu link listing first.
So, my initial thought was "I need to see the weights in the Parent Link select list".

Now, this would not be a really great UI yet, but it would repair the intended use for the weight, and allow users to create AND place a menu item in one step, which would be the expected UX i guess.

A more sophisticated approach was proposed on #605894: Replace menu weight selector on node/add with relative item positioning

PS, rant:
I get another WTF from having all other menus listed at the bottom of the parent link select.
When on the main-menu's add-link page, it makes no sense to me to be able to add the link to some other menu.
This just reduces my overview on selecting the parent.
Am i wrong here?

dawehner’s picture

Issue tags: +Needs reroll

I agree, that this weight there doesn't help that much

alvar0hurtad0’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.7 KB

Reroll

Status: Needs review » Needs work

The last submitted patch, 35: remove_weight_selector-491022-35.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dpi’s picture

Title: Remove Weight Selector From Menu UI » Remove weight field from menu item entity forms
Version: 8.2.x-dev » 8.3.x-dev
Issue summary: View changes

Clarified title. Confused with menu list on first glance.

Reformatted IS, no new content.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bnjmnm’s picture

"needs accessibility review" was added when there was a patch that altered the menu list.

Since then, all iterations are just removing the weight from the menu section of entity forms. - There was no a11y concern about that and is arguably an accessibility improvement. The weights are only useful as they relate to weights of sibling items within a menu, and it's probably best to not give anyone the accidental impression that reordering items in a menu requires having multiple node form tabs open to compare weights.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone made their first commit to this issue’s fork.

quietone’s picture

Issue summary: View changes
quietone’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

So had to run locally as I couldn't run the test-only feature

Reverted the changes besides the 2 test files

Only ran MenuUiNodeTest::testMenuNodeFormWidget as that was the one that had new assertions added. Got

Behat\Mink\Exception\ElementNotFoundException : Form hidden field with id|name|value "menu[weight]" not found.

So test coverage is there

Issue summary appears complete and code change appears to line up.

lauriii’s picture

Issue tags: +Needs change record

Maybe we should consider opening a follow-up for some next steps. I think the first next step would be to always add the new menu item to the end of the list. Another next step would be trying to come up with a better UI for users to select where the new menu link should be added.

I think this also needs a change record.

Wim Leers’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs title update, +Needs issue summary update

This affects the UX (in a positive way!) and may break some contrib tests so it indeed needs a change record. Perhaps it should also get a Drupal 10.3 release note?

Also, the issue summary states there's no UI changes, whereas that's literally the goal of this issue 😅 Also, the title says "menu item entity forms" — but it's specifically only node forms? (This modifies menu_ui_form_node_form_alter() after all.) The current title would make for a confusing commit message.

Wim Leers’s picture

(This issue piqued my curiosity because based on the title it seemed related to #3008064: Deprecate vocabulary weight property, but it is not. Hence my request to clarify all that.)