Ticket #35374: 35374.patch
File 35374.patch, 16.0 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/nav-menus.css
61 61 position: relative; 62 62 } 63 63 64 .blank-slate .menu-name {65 height: 2em;66 }67 68 64 .blank-slate .menu-settings { 69 65 border: none; 70 66 margin-top: 0; … … 180 176 } 181 177 182 178 #nav-menu-header .menu-name-label { 183 margin-top: 4px; 179 display: inline-block; 180 vertical-align: middle; 181 margin-right: 7px; 182 font-style: italic; 184 183 } 185 184 186 185 .nav-menus-php #post-body div.updated, … … 253 252 border-right: 1px solid #ccc; 254 253 } 255 254 256 #wpbody .open-label {257 display: block;258 float:left;259 }260 261 #wpbody .open-label span {262 padding-right: 10px;263 }264 265 .js .input-with-default-title {266 color: #a0a5aa;267 font-style: italic;268 }269 270 255 #menu-management .inside { 271 256 padding: 0 10px; 272 257 } … … 273 258 274 259 /* Add Menu Item Boxes */ 275 260 .postbox .howto input, 276 . accordion-container .howto input{261 .customlinkdiv .menu-item-textbox { 277 262 width: 180px; 278 263 float: right; 279 264 } … … 282 267 margin: 0; 283 268 } 284 269 285 .customlinkdiv .howto input {286 width: 180px;287 }288 289 270 .customlinkdiv p { 290 271 margin-top: 0 291 272 } … … 366 347 /* Create Menu */ 367 348 #menu-name { 368 349 width: 270px; 350 vertical-align: middle; 369 351 } 370 352 371 353 #manage-menu .inside { … … 392 374 width: 180px; 393 375 } 394 376 377 .customlinkdiv label, 395 378 .nav-menus-php .howto span { 379 float: left; 396 380 margin-top: 6px; 397 display: block;398 float: left;399 381 } 400 382 401 383 /* Menu item types */ … … 742 724 /* Major/minor publishing actions (classes) */ 743 725 .nav-menus-php .major-publishing-actions { 744 726 clear: both; 745 padding: 3px 0 6px;727 padding: 7px 0 6px; 746 728 } 747 729 748 730 .nav-menus-php .major-publishing-actions .publishing-action { 749 731 text-align: right; 750 732 float: right; 751 line-height: 23px;752 margin: 4px 0 1px;753 733 } 754 734 755 735 .nav-menus-php .blank-slate .menu-settings { -
src/wp-admin/includes/nav-menu.php
264 264 <div class="customlinkdiv" id="customlinkdiv"> 265 265 <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" /> 266 266 <p id="menu-item-url-wrap"> 267 <label class="howto" for="custom-menu-item-url"> 268 <span><?php _e('URL'); ?></span> 269 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" /> 270 </label> 267 <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label> 268 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" /> 271 269 </p> 272 270 273 271 <p id="menu-item-name-wrap"> 274 <label class="howto" for="custom-menu-item-name"> 275 <span><?php _e( 'Link Text' ); ?></span> 276 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" /> 277 </label> 272 <label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label> 273 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" /> 278 274 </p> 279 275 280 276 <p class="button-controls"> … … 435 431 } 436 432 ?> 437 433 <p class="quick-search-wrap"> 438 <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" /> 434 <label for="quick-search-posttype-<?php echo $post_type_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label> 435 <input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" id="quick-search-posttype-<?php echo $post_type_name; ?>" /> 439 436 <span class="spinner"></span> 440 437 <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?> 441 438 </p> … … 714 711 } 715 712 ?> 716 713 <p class="quick-search-wrap"> 717 <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" /> 714 <label for="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label> 715 <input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" id="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" /> 718 716 <span class="spinner"></span> 719 717 <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> 720 718 </p> -
src/wp-admin/js/common.js
913 913 aria_button_if_js(); 914 914 915 915 $document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu ); 916 917 // Set initial focus on a specific element. 918 $( '.wp-initial-focus' ).focus(); 916 919 }); 917 920 918 921 // Fire a custom jQuery event at the end of window resize -
src/wp-admin/js/nav-menu.js
30 30 menusChanged : false, 31 31 isRTL: !! ( 'undefined' != typeof isRtl && isRtl ), 32 32 negateIfRTL: ( 'undefined' != typeof isRtl && isRtl ) ? -1 : 1, 33 lastSearch: '', 33 34 34 35 // Functions that run on init. 35 36 init : function() { … … 40 41 41 42 this.attachMenuEditListeners(); 42 43 43 this.setupInputWithDefaultTitle();44 44 this.attachQuickSearchListeners(); 45 45 this.attachThemeLocationsListeners(); 46 46 … … 444 444 // Where can they move this menu item? 445 445 if ( 0 !== position ) { 446 446 thisLink = menuItem.find( '.menus-move-up' ); 447 thisLink. prop( 'title', menus.moveUp ).css( 'display', 'inline' );447 thisLink.attr( 'aria-label', menus.moveUp ).css( 'display', 'inline' ); 448 448 } 449 449 450 450 if ( 0 !== position && isPrimaryMenuItem ) { 451 451 thisLink = menuItem.find( '.menus-move-top' ); 452 thisLink. prop( 'title', menus.moveToTop ).css( 'display', 'inline' );452 thisLink.attr( 'aria-label', menus.moveToTop ).css( 'display', 'inline' ); 453 453 } 454 454 455 455 if ( position + 1 !== totalMenuItems && 0 !== position ) { 456 456 thisLink = menuItem.find( '.menus-move-down' ); 457 thisLink. prop( 'title', menus.moveDown ).css( 'display', 'inline' );457 thisLink.attr( 'aria-label', menus.moveDown ).css( 'display', 'inline' ); 458 458 } 459 459 460 460 if ( 0 === position && 0 !== hasSameDepthSibling ) { 461 461 thisLink = menuItem.find( '.menus-move-down' ); 462 thisLink. prop( 'title', menus.moveDown ).css( 'display', 'inline' );462 thisLink.attr( 'aria-label', menus.moveDown ).css( 'display', 'inline' ); 463 463 } 464 464 465 465 if ( ! isPrimaryMenuItem ) { 466 466 thisLink = menuItem.find( '.menus-move-left' ), 467 467 thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft ); 468 thisLink. prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).text( thisLinkText ).css( 'display', 'inline' );468 thisLink.attr( 'aria-label', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).text( thisLinkText ).css( 'display', 'inline' ); 469 469 } 470 470 471 471 if ( 0 !== position ) { … … 472 472 if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) { 473 473 thisLink = menuItem.find( '.menus-move-right' ), 474 474 thisLinkText = menus.under.replace( '%s', prevItemNameRight ); 475 thisLink. prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).text( thisLinkText ).css( 'display', 'inline' );475 thisLink.attr( 'aria-label', menus.moveUnder.replace( '%s', prevItemNameRight ) ).text( thisLinkText ).css( 'display', 'inline' ); 476 476 } 477 477 } 478 478 … … 494 494 title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName ); 495 495 } 496 496 497 $this.prop('title', title).text( title ); 497 // @todo Consider to update just the `aria-label` attribute. 498 $this.attr( 'aria-label', title ).text( title ); 498 499 499 500 // Mark this item's accessibility as refreshed 500 501 $this.data( 'needs_accessibility_refresh', false ); … … 833 834 }); 834 835 }, 835 836 836 /**837 * An interface for managing default values for input elements838 * that is both JS and accessibility-friendly.839 *840 * Input elements that add the class 'input-with-default-title'841 * will have their values set to the provided HTML title when empty.842 */843 setupInputWithDefaultTitle : function() {844 var name = 'input-with-default-title';845 846 $('.' + name).each( function(){847 var $t = $(this), title = $t.attr('title'), val = $t.val();848 $t.data( name, title );849 850 if( '' === val ) $t.val( title );851 else if ( title == val ) return;852 else $t.removeClass( name );853 }).focus( function(){854 var $t = $(this);855 if( $t.val() == $t.data(name) )856 $t.val('').removeClass( name );857 }).blur( function(){858 var $t = $(this);859 if( '' === $t.val() )860 $t.addClass( name ).val( $t.data(name) );861 });862 863 $( '.blank-slate .input-with-default-title' ).focus();864 },865 866 837 attachThemeLocationsListeners : function() { 867 838 var loc = $('#nav-menu-theme-locations'), params = {}; 868 839 params.action = 'menu-locations-save'; … … 882 853 attachQuickSearchListeners : function() { 883 854 var searchTimer; 884 855 885 $('.quick-search').keypress(function(e){ 856 // Uniform events on all "self submitting" fields, see ticket #26600#comment:59 857 $( '.quick-search' ).on( 'input keyup', function( e ) { 886 858 var t = $(this); 887 859 888 860 if( 13 == e.which ) { … … 894 866 895 867 searchTimer = setTimeout(function(){ 896 868 api.updateQuickSearchResults( t ); 897 }, 400); 869 }, 500 ); 870 }).on( 'blur', function() { 871 api.lastSearch = ''; 898 872 }).attr('autocomplete','off'); 899 873 }, 900 874 901 875 updateQuickSearchResults : function(input) { 902 876 var panel, params, 903 minSearchLength = 2,904 q = input.val();877 minSearchLength = 2, 878 q = input.val(); 905 879 906 if( q.length < minSearchLength ) return; 880 /* 881 * Minimum characters for a search. Also avoid a new AJAX search when 882 * the key pressed (e.g.arrows) doesn't change the searched term. 883 */ 884 if ( q.length < minSearchLength || api.lastSearch == q ) { 885 return; 886 } 907 887 888 api.lastSearch = q; 889 908 890 panel = input.parents('.tabs-panel'); 909 891 params = { 910 892 'action': 'menu-quick-search', -
src/wp-admin/nav-menus.php
736 736 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); 737 737 wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); 738 738 739 if ( $one_theme_location_no_menus ) { ?> 739 $menu_name_aria_desc = $add_new_screen ? ' aria-describedby="menu-name-desc"' : ''; 740 741 if ( $one_theme_location_no_menus ) { 742 $menu_name_val = 'value="' . esc_attr( 'Menu 1' ) . '"'; 743 ?> 740 744 <input type="hidden" name="zero-menu-state" value="true" /> 741 <?php } ?> 745 <?php } else { 746 $menu_name_val = 'value="' . esc_attr( $nav_menu_selected_title ) . '"'; 747 } ?> 742 748 <input type="hidden" name="action" value="update" /> 743 749 <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 744 750 <div id="nav-menu-header"> 745 751 <div class="major-publishing-actions"> 746 <label class="menu-name-label howto open-label" for="menu-name"> 747 <span><?php _e( 'Menu Name' ); ?></span> 748 <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" /> 749 </label> 752 <label class="menu-name-label" for="menu-name"><?php _e( 'Menu Name' ); ?></label> 753 <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox" <?php echo $menu_name_val . $menu_name_aria_desc; ?> /> 750 754 <div class="publishing-action"> 751 755 <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?> 752 756 </div><!-- END .publishing-action --> … … 769 773 <?php } ?> 770 774 <?php endif; ?> 771 775 <?php if ( $add_new_screen ) : ?> 772 <p class="post-body-plain" ><?php _e( 'Give your menu a name above, then click Create Menu.' ); ?></p>776 <p class="post-body-plain" id="menu-name-desc"><?php _e( 'Give your menu a name, then click Create Menu.' ); ?></p> 773 777 <?php if ( isset( $_GET['use-location'] ) ) : ?> 774 778 <input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" /> 775 779 <?php endif; ?> … … 801 805 <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 802 806 <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label> 803 807 <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?> 804 <span class="theme-location-set"><?php 808 <span class="theme-location-set"><?php 805 809 /* translators: %s: menu name */ 806 810 printf( _x( '(Currently set to: %s)', 'menu location' ), 807 811 wp_get_nav_menu_object( $menu_locations[ $location ] )->name -
src/wp-includes/class-wp-customize-nav-menus.php
743 743 <span class="toggle-indicator" aria-hidden="true"></span> 744 744 </button> 745 745 </h4> 746 <div class="accordion-section-content ">746 <div class="accordion-section-content customlinkdiv"> 747 747 <input type="hidden" value="custom" id="custom-menu-item-type" name="menu-item[-1][menu-item-type]" /> 748 748 <p id="menu-item-url-wrap"> 749 <label class="howto" for="custom-menu-item-url"> 750 <span><?php _e( 'URL' ); ?></span> 751 <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://"> 752 </label> 749 <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label> 750 <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://"> 753 751 </p> 754 752 <p id="menu-item-name-wrap"> 755 <label class="howto" for="custom-menu-item-name"> 756 <span><?php _e( 'Link Text' ); ?></span> 757 <input id="custom-menu-item-name" name="menu-item[-1][menu-item-title]" type="text" class="regular-text menu-item-textbox"> 758 </label> 753 <label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label> 754 <input id="custom-menu-item-name" name="menu-item[-1][menu-item-title]" type="text" class="regular-text menu-item-textbox"> 759 755 </p> 760 756 <p class="button-controls"> 761 757 <span class="add-to-menu">