Ticket #27555: 27555.5.diff
File 27555.5.diff, 19.5 KB (added by , 7 years ago) |
---|
-
src/wp-admin/css/common.css
759 759 760 760 /* @todo can we combine these into a class or use an existing dashicon one? */ 761 761 .welcome-panel .welcome-panel-close:before, 762 .tagchecklist span a:before,762 .tagchecklist .ntdelbutton .remove-tag-icon:before, 763 763 #bulk-titles div a:before, 764 764 .notice-dismiss:before { 765 765 background: none; … … 779 779 margin: 0; 780 780 } 781 781 782 .tagchecklist span a:before,783 782 #bulk-titles div a:before { 784 783 margin: 1px 0; 785 784 } 786 785 786 .tagchecklist .ntdelbutton .remove-tag-icon:before { 787 margin-left: 2px; 788 -webkit-border-radius: 50%; 789 border-radius: 50%; 790 /* vertically center the icon cross browsers */ 791 line-height: 1.28; 792 } 793 794 .tagchecklist .ntdelbutton:focus { 795 outline: 0; 796 } 797 787 798 .welcome-panel .welcome-panel-close:hover:before, 788 799 .welcome-panel .welcome-panel-close:focus:before, 789 .tagchecklist span a:hover:before, 790 #bulk-titles div a:hover:before { 800 .tagchecklist .ntdelbutton:hover .remove-tag-icon:before, 801 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before, 802 #bulk-titles div a:hover:before, 803 #bulk-titles div a:focus:before { 791 804 color: #c00; 792 805 } 793 806 807 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 808 -webkit-box-shadow: 809 0 0 0 1px #5b9dd9, 810 0 0 2px 1px rgba(30, 140, 190, .8); 811 box-shadow: 812 0 0 0 1px #5b9dd9, 813 0 0 2px 1px rgba(30, 140, 190, .8); 814 } 815 794 816 .key-labels label { 795 817 line-height: 24px; 796 818 } … … 3571 3593 .sidebar-name-arrow, 3572 3594 .sidebar-name:hover .sidebar-name-arrow, 3573 3595 .meta-box-sortables .postbox:hover .handlediv, 3574 .tagchecklist span a,3575 3596 #bulk-titles div a, 3576 .tagchecklist span a:hover,3577 3597 #bulk-titles div a:hover { 3578 3598 background: none !important; 3579 3599 } -
src/wp-admin/css/customize-controls.css
241 241 box-sizing: border-box; 242 242 -webkit-transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 243 243 transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 244 -webkit-transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1); 244 245 transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1); 246 -webkit-transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1), 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 245 247 transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1), 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); /* easeInOutCubic */ 246 248 } 247 249 -
src/wp-admin/css/edit.css
582 582 position: absolute; 583 583 } 584 584 585 .tagchecklist span { 585 .tagchecklist > span { 586 float: left; 586 587 margin-right: 25px; 587 display: block;588 float: left;589 588 font-size: 13px; 590 589 line-height: 1.8em; 591 590 cursor: default; … … 594 593 text-overflow: ellipsis; 595 594 } 596 595 597 .tagchecklist span a { 598 margin: 1px 0 0 -17px; 596 .tagchecklist .ntdelbutton { 597 position: absolute; 598 width: 24px; 599 height: 24px; 600 border: none; 601 margin: 0 0 0 -19px; 602 padding: 0; 603 background: none; 599 604 cursor: pointer; 600 width: 20px;601 height: 20px;602 display: block;603 float: left;604 605 text-indent: 0; 605 overflow: hidden;606 position: absolute;607 606 } 608 607 609 608 #poststuff h3.hndle, /* Back-compat for pre-4.4 */ … … 1027 1026 width: 260px; 1028 1027 } 1029 1028 1029 .tagcloud-link.button-link { 1030 color: #0073aa; 1031 text-decoration: underline; 1032 } 1033 1034 .tagcloud-link.button-link:hover { 1035 color: #00a0d2; 1036 } 1037 1038 .tagcloud-link.button-link:focus { 1039 color: #124964; 1040 -webkit-box-shadow: 1041 0 0 0 1px #5b9dd9, 1042 0 0 2px 1px rgba(30, 140, 190, .8); 1043 box-shadow: 1044 0 0 0 1px #5b9dd9, 1045 0 0 2px 1px rgba(30, 140, 190, .8); 1046 } 1047 1030 1048 #post-body-content .tagsdiv .the-tags { 1031 1049 margin: 0 5px; 1032 1050 } … … 1052 1070 margin: 2px 0 12px; 1053 1071 } 1054 1072 1073 /* Suggest.js autocomplete, no more used by core. */ 1055 1074 .ac_results { 1056 1075 display: none; 1057 1076 margin: -1px 0 0; … … 1438 1457 margin: 25px 10px; 1439 1458 } 1440 1459 1441 .tagchecklist span {1460 .tagchecklist > span { 1442 1461 font-size: 16px; 1443 1462 line-height: 1.4; 1444 1463 } -
src/wp-admin/css/forms.css
594 594 padding: 4px 10px; 595 595 white-space: nowrap; 596 596 text-align: left; 597 cursor: pointer; 597 598 } 598 599 599 .ui-autocomplete li.ui-state-focus { 600 /* Colors for the wplink toolbar autocomplete. */ 601 .ui-autocomplete .ui-state-focus { 600 602 background-color: #ddd; 601 cursor: pointer;602 603 } 603 604 605 /* Colors for the tags autocomplete. */ 606 .wp-tags-autocomplete .ui-state-focus { 607 background-color: #0073aa; 608 color: #fff; 609 } 610 604 611 /*------------------------------------------------------------------------------ 605 612 15.0 - Comments Screen 606 613 ------------------------------------------------------------------------------*/ -
src/wp-admin/css/ie.css
441 441 padding-right: 1px; 442 442 } 443 443 444 .tagchecklist span, .tagchecklist span a{444 .tagchecklist > span, .tagchecklist .ntdelbutton { 445 445 display: inline-block; 446 446 display: block; 447 447 } 448 448 449 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 450 outline: 1px solid #5b9dd9; 451 } 452 449 453 .tablenav .button, 450 454 .nav .button { 451 455 padding-top: 2px; -
src/wp-admin/css/press-this.css
770 770 margin: 10px 0 6px 16px; 771 771 } 772 772 773 774 /* Tag hint TODO needed? */775 /* Tag suggestions */776 .ac_results {777 padding: 0;778 margin: -1px 0 0 -1px;779 list-style: none;780 position: absolute;781 z-index: 10000;782 display: none;783 border: 1px solid #d8d8d8;784 background-color: #fff;785 font-size: 14px;786 }787 788 .ac_results li {789 padding: 6px 16px;790 white-space: nowrap;791 text-align: left;792 }793 794 .ac_results .ac_over {795 background-color: #e5e5e5;796 background-color: #00a0d2;797 color: #fff;798 cursor: pointer;799 }800 801 .ac_match {802 text-decoration: underline;803 }804 805 773 /* Tags */ 806 774 .tagchecklist { 807 775 padding: 16px 28px 5px; … … 817 785 clear: both; 818 786 } 819 787 820 .tagchecklist span {821 display: block;788 .tagchecklist > span { 789 float: left; 822 790 margin-right: 25px; 823 float: left;824 791 font-size: 13px; 825 792 line-height: 1.8; 826 793 white-space: nowrap; … … 828 795 } 829 796 830 797 @media (max-width: 600px) { 831 .tagchecklist span {798 .tagchecklist > span { 832 799 margin-bottom: 15px; 833 800 font-size: 16px; 834 801 line-height: 1.3; … … 836 803 } 837 804 838 805 .tagchecklist .ntdelbutton { 839 margin: 1px 0 0 -17px; 806 position: absolute; 807 width: 24px; 808 height: 24px; 809 border: none; 810 margin: 0 0 0 -19px; 811 padding: 0; 812 background: none; 840 813 cursor: pointer; 841 width: 20px; 842 height: 20px; 843 display: block; 844 float: left; 845 text-indent: 0; 846 overflow: hidden; 814 text-indent: 0;; 847 815 position: absolute; 848 outline: 0;849 816 } 850 817 851 .tagchecklist .ntdelbutton :before {818 .tagchecklist .ntdelbutton .remove-tag-icon:before { 852 819 content: "\f153"; 853 820 display: block; 854 margin : 2px 0;821 margin-left: 2px; 855 822 height: 20px; 856 823 width: 20px; 857 background: 0 0; 824 -webkit-border-radius: 50%; 825 border-radius: 50%; 826 background: transparent; 858 827 color: #9ea7af; 859 font: 400 16px/1 dashicons; 828 /* line-height tweak to vertically center the icon cross browsers */ 829 font: 400 16px/1.28 dashicons; 860 830 text-align: center; 861 speak: none;862 831 -webkit-font-smoothing: antialiased; 863 832 } 864 833 865 .tagchecklist .ntdelbutton:focus :before{866 color: #00a0d2;834 .tagchecklist .ntdelbutton:focus { 835 outline: 0; 867 836 } 868 837 838 .tagchecklist .ntdelbutton:hover .remove-tag-icon:before, 839 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 840 color: #c00; 841 } 869 842 843 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 844 -webkit-box-shadow: 845 0 0 0 1px #5b9dd9, 846 0 0 2px 1px rgba(30, 140, 190, .8); 847 box-shadow: 848 0 0 0 1px #5b9dd9, 849 0 0 2px 1px rgba(30, 140, 190, .8); 850 } 851 870 852 /* THE TAG CLOUD. */ 871 853 .tagsdiv + p { 872 854 margin: 0; … … 2194 2176 -webkit-box-shadow: 0 1px 2px rgba( 30, 140, 190, 0.8 ); 2195 2177 box-shadow: 0 1px 2px rgba( 30, 140, 190, 0.8 ); 2196 2178 background-color: #fff; 2179 font-size: 14px; 2197 2180 } 2198 2181 2199 2182 .ui-autocomplete li { … … 2201 2184 padding: 4px 10px; 2202 2185 white-space: nowrap; 2203 2186 text-align: left; 2187 cursor: pointer; 2204 2188 } 2205 2189 2206 .ui-autocomplete li.ui-state-focus { 2190 /* Colors for the wplink toolbar autocomplete. */ 2191 .ui-autocomplete .ui-state-focus { 2207 2192 background-color: #ddd; 2208 cursor: pointer;2209 2193 } 2194 2195 /* Colors for the tags autocomplete. */ 2196 .wp-tags-autocomplete .ui-state-focus { 2197 background-color: #0073aa; 2198 color: #fff; 2199 } -
src/wp-admin/includes/class-wp-press-this.php
940 940 941 941 if ( $user_can_assign_terms ) { 942 942 ?> 943 <button type="button" class="button-link tagcloud-link" id="link-post_tag" ><?php echo $taxonomy->labels->choose_from_most_used; ?></button>943 <button type="button" class="button-link tagcloud-link" id="link-post_tag" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button> 944 944 <?php 945 945 } 946 946 } -
src/wp-admin/includes/meta-boxes.php
442 442 <div class="tagchecklist"></div> 443 443 </div> 444 444 <?php if ( $user_can_assign_terms ) : ?> 445 <p class="hide-if-no-js">< a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>445 <p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-<?php echo $tax_name; ?>" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button></p> 446 446 <?php endif; ?> 447 447 <?php 448 448 } -
src/wp-admin/js/tags-box.js
86 86 87 87 // If tags editing isn't disabled, create the X button. 88 88 if ( ! disabled ) { 89 xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton" tabindex="0">X</a>' ); 89 /* 90 * Build the X buttons, hide the X icon with aria-hidden and 91 * use visually hidden text for screen readers. 92 */ 93 xbutton = $( '<button type="button" id="' + id + '-check-num-' + key + '" class="ntdelbutton">' + 94 '<span class="remove-tag-icon" aria-hidden="true"></span>' + 95 '<span class="screen-reader-text">' + window.tagsSuggestL10n.removeTerm + ' ' + val + '</span>' + 96 '</button>' ); 90 97 91 98 xbutton.on( 'click keypress', function( e ) { 92 // Trigger function if pressed Enter - keyboard navigation 93 if ( e.type === 'click' || e.keyCode === 13 ) { 94 // When using keyboard, move focus back to the new tag field. 95 if ( e.keyCode === 13 ) { 96 $( this ).closest( '.tagsdiv' ).find( 'input.newtag' ).focus(); 97 } 99 // On click or when using the Enter/Spacebar keys. 100 if ( 'click' === e.type || 13 === e.keyCode || 32 === e.keyCode ) { 101 /* 102 * When using the keyboard, move focus back to the 103 * add new tag field. Note: when releasing the pressed 104 * key this will fire the `keyup` event on the input. 105 */ 106 if ( 13 === e.keyCode || 32 === e.keyCode ) { 107 $( this ).closest( '.tagsdiv' ).find( 'input.newtag' ).focus(); 108 } 98 109 110 tagBox.userAction = 'remove'; 99 111 tagBox.parseTags( this ); 100 112 } 101 113 }); … … 106 118 // Append the span to the tag list. 107 119 tagchecklist.append( span ); 108 120 }); 121 // The buttons list is built now, give feedback to screen reader users. 122 tagBox.screenReadersMessage(); 109 123 }, 110 124 111 125 flushTags : function( el, a, f ) { … … 117 131 118 132 text = a ? $(a).text() : newtag.val(); 119 133 120 if ( 'undefined' == typeof( text ) ) { 134 /* 135 * Return if there's no new tag or if the input field is empty. 136 * Note: when using the keyboard to add tags, focus is moved back to 137 * the input field and the `keyup` event attached on this field will 138 * fire when releasing the pressed key. Checking also for the field 139 * emptiness avoids to set the tags and call quickClicks() again. 140 */ 141 if ( 'undefined' == typeof( text ) || '' === text ) { 121 142 return false; 122 143 } 123 144 … … 148 169 r = $( '<p id="tagcloud-' + tax + '" class="the-tagcloud">' + r + '</p>' ); 149 170 150 171 $( 'a', r ).click( function() { 172 tagBox.userAction = 'add'; 151 173 tagBox.flushTags( $( '#' + tax ), this ); 152 174 return false; 153 175 }); … … 156 178 }); 157 179 }, 158 180 181 /** 182 * Track the user's last action. 183 * 184 * @since 4.7.0 185 */ 186 userAction: '', 187 188 /** 189 * Dispatch an audible message to screen readers. 190 * 191 * @since 4.7.0 192 */ 193 screenReadersMessage: function() { 194 var message; 195 196 switch ( this.userAction ) { 197 case 'remove': 198 message = window.tagsSuggestL10n.termRemoved; 199 break; 200 201 case 'add': 202 message = window.tagsSuggestL10n.termAdded; 203 break; 204 205 default: 206 return; 207 } 208 209 window.wp.a11y.speak( message, 'assertive' ); 210 }, 211 159 212 init : function() { 160 213 var ajaxtag = $('div.ajaxtag'); 161 214 … … 164 217 }); 165 218 166 219 $( '.tagadd', ajaxtag ).click( function() { 220 tagBox.userAction = 'add'; 167 221 tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); 168 222 }); 169 223 170 224 $( 'input.newtag', ajaxtag ).keyup( function( event ) { 171 225 if ( 13 == event.which ) { 226 tagBox.userAction = 'add'; 172 227 tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); 173 228 event.preventDefault(); 174 229 event.stopPropagation(); … … 189 244 }); 190 245 }); 191 246 192 // tag cloud247 // Fetch and toggle the Tag cloud. 193 248 $('.tagcloud-link').click(function(){ 194 tagBox.get( $(this).attr('id') ); 195 $(this).unbind().click(function(){ 196 $(this).siblings('.the-tagcloud').toggle(); 197 return false; 198 }); 199 return false; 249 // On the first click, fetch the tag cloud and insert it in the DOM. 250 tagBox.get( $( this ).attr( 'id' ) ); 251 // Update button state, remove previous click and attach new one to toggle the cloud. 252 $( this ) 253 .attr( 'aria-expanded', 'true' ) 254 .unbind() 255 .click( function() { 256 $( this ) 257 .attr( 'aria-expanded', 'false' === $( this ).attr( 'aria-expanded' ) ? 'true' : 'false' ) 258 .siblings( '.the-tagcloud' ).toggle(); 259 }); 200 260 }); 201 261 } 202 262 }; -
src/wp-admin/js/tags-suggest.js
1 /** 2 * Default settings for jQuery UI Autocomplete for use with non-hierarchical taxonomies. 3 */ 1 4 ( function( $ ) { 5 if ( typeof window.tagsSuggestL10n === 'undefined' || typeof window.uiAutocompleteL10n === 'undefined' ) { 6 return; 7 } 8 2 9 var tempID = 0; 3 var separator = ( window.tagsSuggestL10n && window.tagsSuggestL10n.tagDelimiter )|| ',';10 var separator = window.tagsSuggestL10n.tagDelimiter || ','; 4 11 5 12 function split( val ) { 6 13 return val.split( new RegExp( separator + '\\s*' ) ); … … 10 17 return split( term ).pop(); 11 18 } 12 19 20 /** 21 * Add UI Autocomplete to an input or textarea element with presets for use 22 * with non-hierarchical taxonomies. 23 * 24 * Example: `$( element ).wpTagsSuggest( options )`. 25 * 26 * The taxonomy can be passed in a `data-wp-taxonomy` attribute on the element or 27 * can be in `options.taxonomy`. 28 * 29 * @since 4.7 30 * 31 * @param {object} options Options that are passed to UI Autocomplete. Can be used to override the default settings. 32 * @returns {object} jQuery instance. 33 */ 13 34 $.fn.wpTagsSuggest = function( options ) { 14 35 var cache; 15 36 var last; … … 16 37 var $element = $( this ); 17 38 18 39 options = options || {}; 19 40 20 41 var taxonomy = options.taxonomy || $element.attr( 'data-wp-taxonomy' ) || 'post_tag'; 21 42 22 43 delete( options.taxonomy ); 23 44 24 45 options = $.extend( { 25 source: function( request, response ) { 46 source: function( request, response ) { 26 47 var term; 27 48 28 49 if ( last === request.term ) { … … 39 60 } ).always( function() { 40 61 $element.removeClass( 'ui-autocomplete-loading' ); // UI fails to remove this sometimes? 41 62 } ).done( function( data ) { 42 var value;43 var t erms = [];63 var tagName; 64 var tags = []; 44 65 45 66 if ( data ) { 46 67 data = data.split( '\n' ); 47 68 48 for ( value in data ) {69 for ( tagName in data ) { 49 70 var id = ++tempID; 50 71 51 t erms.push({72 tags.push({ 52 73 id: id, 53 name: data[ value]74 name: data[tagName] 54 75 }); 55 76 } 56 77 57 cache = t erms;58 response( t erms );78 cache = tags; 79 response( tags ); 59 80 } else { 60 response( t erms );81 response( tags ); 61 82 } 62 83 } ); 63 84 … … 80 101 $element.val( tags.join( separator + ' ' ) ); 81 102 82 103 if ( $.ui.keyCode.TAB === event.keyCode ) { 83 if ( typeof window.uiAutocompleteL10n !== 'undefined' ) { 84 // Audible confirmation message when a tag has been selected. 85 window.wp.a11y.speak( window.uiAutocompleteL10n.itemSelected ); 86 } 87 104 // Audible confirmation message when a tag has been selected. 105 window.wp.a11y.speak( window.tagsSuggestL10n.termSelected, 'assertive' ); 88 106 event.preventDefault(); 89 107 } else if ( $.ui.keyCode.ENTER === event.keyCode ) { 90 108 // Do not close Quick Edit / Bulk Edit … … 105 123 my: 'left top+2' 106 124 }, 107 125 messages: { 108 noResults: ( typeof window.uiAutocompleteL10n !== 'undefined' ) ? window.uiAutocompleteL10n.noResults : '',126 noResults: window.uiAutocompleteL10n.noResults, 109 127 results: function( number ) { 110 if ( typeof window.uiAutocompleteL10n !== 'undefined' ) { 111 if ( number > 1 ) { 112 return window.uiAutocompleteL10n.manyResults.replace( '%d', number ); 113 } 128 if ( number > 1 ) { 129 return window.uiAutocompleteL10n.manyResults.replace( '%d', number ); 130 } 114 131 115 return window.uiAutocompleteL10n.oneResult; 116 } 132 return window.uiAutocompleteL10n.oneResult; 117 133 } 118 134 } 119 135 }, options ); … … 160 176 // so we need to find the active item with other means. 161 177 $( this ).find( '[aria-selected="true"]' ).removeAttr( 'aria-selected' ); 162 178 }); 163 179 164 180 return this; 165 181 }; 166 182 -
src/wp-includes/script-loader.php
531 531 $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 ); 532 532 did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array( 533 533 'tagDelimiter' => _x( ',', 'tag delimiter' ), 534 'removeTerm' => __( 'Remove term:' ), 535 'termSelected' => __( 'Term selected.' ), 536 'termAdded' => __( 'Term added.' ), 537 'termRemoved' => __( 'Term removed.' ), 534 538 ) ); 535 539 536 540 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );