diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js
index 3b7af24302..0c4238dd01 100644
|
|
|
1518 | 1518 | * Update item handle title when changed. |
1519 | 1519 | */ |
1520 | 1520 | _setupTitleUI: function() { |
1521 | | var control = this; |
| 1521 | var control = this, titleEl; |
| 1522 | |
| 1523 | // Ensure that whitespace is trimmed on blur so placeholder can be shown, |
| 1524 | control.container.find( '.edit-menu-item-title' ).on( 'blur', function() { |
| 1525 | $( this ).val( $.trim( $( this ).val() ) ); |
| 1526 | } ); |
1522 | 1527 | |
| 1528 | titleEl = control.container.find( '.menu-item-title' ); |
1523 | 1529 | control.setting.bind( function( item ) { |
| 1530 | var trimmedTitle, titleText; |
1524 | 1531 | if ( ! item ) { |
1525 | 1532 | return; |
1526 | 1533 | } |
| 1534 | trimmedTitle = $.trim( item.title ); |
1527 | 1535 | |
1528 | | var titleEl = control.container.find( '.menu-item-title' ), |
1529 | | titleText = item.title || item.original_title || api.Menus.data.l10n.untitled; |
| 1536 | titleText = trimmedTitle || item.original_title || api.Menus.data.l10n.untitled; |
1530 | 1537 | |
1531 | 1538 | if ( item._invalid ) { |
1532 | 1539 | titleText = api.Menus.data.l10n.invalidTitleTpl.replace( '%s', titleText ); |
1533 | 1540 | } |
1534 | 1541 | |
1535 | 1542 | // Don't update to an empty title. |
1536 | | if ( item.title || item.original_title ) { |
| 1543 | if ( trimmedTitle || item.original_title ) { |
1537 | 1544 | titleEl |
1538 | 1545 | .text( titleText ) |
1539 | 1546 | .removeClass( 'no-title' ); |