[wp-trac] [WordPress Trac] #24146: Menu items with blank labels are removed on saving

WordPress Trac noreply at wordpress.org
Sun Dec 22 16:49:36 UTC 2019


#24146: Menu items with blank labels are removed on saving
-------------------------------------------------+-------------------------
 Reporter:  rodrigo@…                            |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Menus                                |     Version:  3.5.1
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback has-patch needs-        |     Focuses:
  testing                                        |
-------------------------------------------------+-------------------------

Comment (by ElectricFeet):

 Reminder to self: check Trac **exhaustiveley** before writing out a bug
 report.

 I'll add my text here anyway, as it elaborates on some of the reasoning
 behind this issue -- specifically giving a scenario where this happens.
 Reading through the various comments above and noting that it's taking so
 long to fix, you might want to consider at least taking approach B (below)
 to the problem. That is, at least warn the user you're about to delete
 their work before deleting it.


 == Original aim:
 To create menu items that shows icons with no text.

 == Problem:
 Menu items can be deleted with no warning.

 == Steps to reproduce problem:
 1. Create new menu
 2. Create two new custom links (for example to `https://example.com`),
 with Link Text `test1` and `test2`, adding each to the menu
 3. Save the menu.
 4. On the Manage Locations tab, add this menu to a theme location you will
 be able to see and save your changes.
 5. View site and check that the two menu items are there.
 6. Go back to Edit Menus. If the CSS Classes box is not available, enable
 it from the Screen Options pull down (top right of screen)
 7. Open the test1 menu item and add `fa fa-envelope` to the CSS classes.
 8. Delete the navigation label and save the menu.

 The menu item `test1` disappears and there is no way to get it back. The
 site does not display it. There was no warning or other indication to the
 user that the item was to be deleted. If this has been done for a lot of
 menu items, a lot of time/work is lost.

 I should point out that I know that I can add `<span class="fa fa-
 envelope"></span>` to the navigation label to get the result I need; my
 issue is with no warning of impending deletion if a user tries to do this
 in the way described above.

 == Recommendation:
 A. I recommend that //the menu item should remain, with no navigation
 label// (similar to what happens if you add ` ` to the menu). This
 allows the user to continue to modify it -- including to remove it, if
 that was the original intention. (It's very unlikely that users will want
 to delete menu items by removing the navigation label, when they have a
 red "Remove" link at the bottom.)

 B. If it isn't possible to implement A, then -- in the case that there are
 menu items without Navigation Labels when the user clicks Save Menu --
 another approach would be to //warn the user// that menu items without
 Navigation Labels will be deleted, and allow them to cancel the save. That
 way, they will be able to re-instate the navigation labels and not lose
 all their menu items.

 Personally, I much prefer A. It gives the user more flexibility, behaviour
 is not unexpected, and allows more creative use of pseudo elements /
 classes etc.

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


More information about the wp-trac mailing list