Opened 8 years ago
Closed 5 years ago
#38415 closed defect (bug) (fixed)
New Custom Link menu item has a wrong fallback label
Reported by: | afercia | Owned by: | afercia |
---|---|---|---|
Milestone: | 5.2.3 | Priority: | normal |
Severity: | normal | Version: | 4.5 |
Component: | Menus | Keywords: | has-screenshots good-first-bug has-patch needs-testing fixed-major |
Focuses: | ui | Cc: |
Description (last modified by )
On the menus screen, when adding a Custom Link to a menu and leaving the link text field empty, a default fallback Menu Item
label was set:
On the latest versions though, the fallback label is (Pending)
, with a leading space:
This was broken by [36379] my bad. Haven't looked in depth in the code but I think it could be fixed on the PHP side, I guess there's no need to restore the JS part that was removed in [36379].
Attachments (4)
Change History (21)
#2
in reply to:
↑ 1
@
8 years ago
I think having Menu Item (Pending) makes sense. I'm new to this but is there a reason we don't make the text field for Custom Links required?
#3
@
6 years ago
- Description modified (diff)
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to Future Release
@
6 years ago
As per the suggestion, I have changed the label. Please look over it and let me know if anything more is required.
#5
@
5 years ago
Works fine with my local VVV-setup and fixes the issue (tested on WordCamp EU Contributor Day).
#7
@
5 years ago
- Milestone changed from Future Release to 5.3
- Owner set to afercia
- Status changed from new to assigned
#8
@
5 years ago
- Keywords commit removed
Thanks everyone! I tried to look a bit more in depth into this and there are a few things to consider. Testing with JavaScript support disabled and enabled:
JavaScript disabled:
When adding menu items, an additional string (Pending)
gets appended to the item name. Also, a notice "Click Save Menu..." appears at the top:
Looks like this part was never implemented in the JavaScript-based implementation.
JavaScript enabled:
The additional string (Pending)
is intentionally not displayed. Also the notice doesn't appear.
To respect the original implementation, the string (Pending)
shouldn't be displayed. I'd like to propose to just restore the original behavior: when a custom link text is empty, a default "Menu Item" string is used as fallback.
I've noticed a couple inconsistencies in the PHP part and I'm not sure the Custom Links are fully functional when JavaScript is disabled but seems to me those are pre-existing issues. Considering the Menu page will be refactored soon to use blocks, I'd tend to think the best option is to restore a mechanism to have the fallback to athe"Menu Item" string.
#9
@
5 years ago
38415.diff adds a fallback to Menu Item
in the ajax action used for the JS implementation. This should restore the original behavior as detailed above. Some testing would be nice :)
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
5 years ago
#13
@
5 years ago
- Keywords needs-testing fixed-major added
- Milestone changed from 5.3 to 5.2.3
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening this so it can be back-ported to the 5.2 branch.
Adding needs-testing
since we have to check it's ok to land in 5.2.3.
#14
@
5 years ago
Tested on my side against 5.2.2. The patch looks good to go and works fine but unless I'm mistaken [45727] doesn't look to apply cleanly: ajax-actions.php
seems to have some dependancies to previous commits.
Would a feasible approach be to simply add Menu Item to
https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-walker-nav-menu-edit.php#L103?
e.g.:
$title = sprintf( __('%s Menu Item (Pending)'), $item->title );