Ticket #35374: 35374.2.patch
File 35374.2.patch, 16.4 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; … … 179 175 } 180 176 181 177 #nav-menu-header .menu-name-label { 182 margin-top: 4px; 178 display: inline-block; 179 vertical-align: middle; 180 margin-right: 7px; 181 font-style: italic; 183 182 } 184 183 185 184 .nav-menus-php #post-body div.updated, … … 248 247 border-right: 1px solid #ccc; 249 248 } 250 249 251 #wpbody .open-label {252 display: block;253 float:left;254 }255 256 #wpbody .open-label span {257 padding-right: 10px;258 }259 260 .js .input-with-default-title {261 color: #a0a5aa;262 font-style: italic;263 }264 265 250 #menu-management .inside { 266 251 padding: 0 10px; 267 252 } … … 268 253 269 254 /* Add Menu Item Boxes */ 270 255 .postbox .howto input, 271 . accordion-container .howto input{256 .customlinkdiv .menu-item-textbox { 272 257 width: 180px; 273 258 float: right; 274 259 } … … 277 262 margin: 0; 278 263 } 279 264 280 .customlinkdiv .howto input {281 width: 180px;282 }283 284 265 .customlinkdiv p { 285 266 margin-top: 0 286 267 } … … 355 336 /* Create Menu */ 356 337 #menu-name { 357 338 width: 270px; 339 vertical-align: middle; 358 340 } 359 341 360 342 #manage-menu .inside { … … 381 363 width: 180px; 382 364 } 383 365 366 .customlinkdiv label, 384 367 .nav-menus-php .howto span { 368 float: left; 385 369 margin-top: 6px; 386 display: block;387 float: left;388 370 } 389 371 390 372 /* Menu item types */ … … 731 713 /* Major/minor publishing actions (classes) */ 732 714 .nav-menus-php .major-publishing-actions { 733 715 clear: both; 734 padding: 3px 0 6px;716 padding: 7px 0 6px; 735 717 } 736 718 737 719 .nav-menus-php .major-publishing-actions .publishing-action { 738 720 text-align: right; 739 721 float: right; 740 line-height: 23px;741 margin: 4px 0 1px;742 722 } 743 723 744 724 .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'; … … 880 851 }, 881 852 882 853 attachQuickSearchListeners : function() { 883 var searchTimer; 854 var searchTimer, 855 inputEvent; 884 856 885 $('.quick-search').keypress(function(e){ 857 /* 858 * Use feature detection to determine whether password inputs should use 859 * the `keyup` or `input` event. Input is preferred but lacks support 860 * in legacy browsers. See changeset 34078, see also ticket #26600#comment:59 861 */ 862 if ( 'oninput' in document.createElement( 'input' ) ) { 863 inputEvent = 'input'; 864 } else { 865 inputEvent = 'keyup'; 866 } 867 868 $( '.quick-search' ).on( inputEvent, function( e ) { 886 869 var t = $(this); 887 870 888 871 if( 13 == e.which ) { … … 894 877 895 878 searchTimer = setTimeout(function(){ 896 879 api.updateQuickSearchResults( t ); 897 }, 400); 880 }, 500 ); 881 }).on( 'blur', function() { 882 api.lastSearch = ''; 898 883 }).attr('autocomplete','off'); 899 884 }, 900 885 901 886 updateQuickSearchResults : function(input) { 902 887 var panel, params, 903 minSearchLength = 2,904 q = input.val();888 minSearchLength = 2, 889 q = input.val(); 905 890 906 if( q.length < minSearchLength ) return; 891 /* 892 * Minimum characters for a search. Also avoid a new AJAX search when 893 * the key pressed (e.g.arrows) doesn't change the searched term. 894 */ 895 if ( q.length < minSearchLength || api.lastSearch == q ) { 896 return; 897 } 907 898 899 api.lastSearch = q; 900 908 901 panel = input.parents('.tabs-panel'); 909 902 params = { 910 903 '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">