WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 6 months ago

#38015 closed defect (bug) (fixed)

Customize: Nav menu items should preview using original object title if not title supplied

Reported by: westonruter Owned by: westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch commit
Focuses: Cc:

Description

In wp_setup_nav_menu_item() there is logic to set the nav menu item's title to be the original post or term's title if no title is supplied. This logic is not getting applied when previewing in the customizer, however.

Attachments (2)

38015.0.diff (1.7 KB) - added by westonruter 11 months ago.
38015.1.diff (9.8 KB) - added by westonruter 11 months ago.

Download all attachments as: .zip

Change History (12)

#1 @westonruter
11 months ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by celloexpressions. View the logs.


11 months ago

#3 @celloexpressions
11 months ago

  • Keywords commit added

Nice catch! Tested and the patch looks ready to commit to me.

#4 @westonruter
11 months ago

  • Keywords commit removed

@celloexpressions I found a couple other situations where original_title wasn't being used.

  1. Original title wasn't being used as the control title.
  2. Original title wasn't being used as a placeholder for the nav label input field.

And then the original title was being used where it shouldn't, namely when loading the customizer when a nav menu item that had an empty title it would get populate with the original title. So you could save the customizer with a blank title and then reload the customizer and you'd see the navigation label no longer empty.

See 38015.1.diff

#5 @celloexpressions
11 months ago

  • Keywords commit added

Looks good to me with those additional fixes.

#6 @westonruter
11 months ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 38618:

Customize: Ensure nav menu items lacking a label use the title from the original object.

Use original title as placeholder for label and in control title. Prevent original title from overriding empty label in initial setting values.

Fixes #38015.

#7 @westonruter
9 months ago

In 39393:

Customize: Fix handling of the nav menu item labels (titles) that match defaults (original titles) and fix the display of item type labels.

  • Show default labels for nav menu item as placeholders in a control's label field instead of showing blank.
  • Store empty string as label instead of copying default labels.
  • Prevent labels for post type archive items from being dropped in preview.
  • Also ensure that the item type label is displayed on nav menu item controls for settings that are loaded from an existing changeset.

Amends [38618].
See #38015.
Fixes #38955.

#8 @westonruter
9 months ago

In 39395:

Customize: Fix handling of the nav menu item labels (titles) that match defaults (original titles) and fix the display of item type labels.

  • Show default labels for nav menu item as placeholders in a control's label field instead of showing blank.
  • Store empty string as label instead of copying default labels.
  • Prevent labels for post type archive items from being dropped in preview.
  • Also ensure that the item type label is displayed on nav menu item controls for settings that are loaded from an existing changeset.

Amends [38618].
See #38015.
Fixes #38955 for 4.7 branch.

#9 @westonruter
7 months ago

In 39994:

Customize: Trim whitespace from nav menu item titles so that the underlying object's original title appears as input placeholder and in the control's title.

Whitespace is trimmed from titles in PHP when saved in any case, so this aligns the client-side behavior with what happens on the server.

Amends [38618].
See #38015.
Fixes #39600.

#10 @dd32
6 months ago

In 40094:

Customize: Trim whitespace from nav menu item titles so that the underlying object's original title appears as input placeholder and in the control's title.

Whitespace is trimmed from titles in PHP when saved in any case, so this aligns the client-side behavior with what happens on the server.

Amends [38618].
Merges [39994] to the 4.7 branch.
See #38015.
Fixes #39600.

Note: See TracTickets for help on using tickets.