Changeset 38880
- Timestamp:
- 10/23/2016 06:15:07 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/common.css
r38648 r38880 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 { … … 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 color: #0073aa; 791 /* vertically center the icon cross browsers */ 792 line-height: 1.28; 793 } 794 795 .tagchecklist .ntdelbutton:focus { 796 outline: 0; 797 } 798 787 799 .welcome-panel .welcome-panel-close:hover:before, 788 800 .welcome-panel .welcome-panel-close:focus:before, 789 .tagchecklist span a:hover:before, 790 #bulk-titles div a:hover:before { 801 .tagchecklist .ntdelbutton:hover .remove-tag-icon:before, 802 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before, 803 #bulk-titles div a:hover:before, 804 #bulk-titles div a:focus:before { 791 805 color: #c00; 806 } 807 808 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 809 -webkit-box-shadow: 810 0 0 0 1px #5b9dd9, 811 0 0 2px 1px rgba(30, 140, 190, .8); 812 box-shadow: 813 0 0 0 1px #5b9dd9, 814 0 0 2px 1px rgba(30, 140, 190, .8); 792 815 } 793 816 … … 3572 3595 .sidebar-name:hover .sidebar-name-arrow, 3573 3596 .meta-box-sortables .postbox:hover .handlediv, 3574 .tagchecklist span a,3575 3597 #bulk-titles div a, 3576 .tagchecklist span a:hover,3577 3598 #bulk-titles div a:hover { 3578 3599 background: none !important; -
trunk/src/wp-admin/css/customize-controls.css
r38853 r38880 277 277 -webkit-transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 278 278 transition: 0.18s -webkit-transform cubic-bezier(0.645, 0.045, 0.355, 1); 279 -webkit-transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1); 279 280 transition: 0.18s transform cubic-bezier(0.645, 0.045, 0.355, 1); 281 -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); 280 282 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 */ 281 283 } -
trunk/src/wp-admin/css/edit.css
r38700 r38880 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; … … 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 … … 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; … … 1053 1071 } 1054 1072 1073 /* Suggest.js autocomplete, no more used by core. */ 1055 1074 .ac_results { 1056 1075 display: none; … … 1439 1458 } 1440 1459 1441 .tagchecklist span {1460 .tagchecklist > span { 1442 1461 font-size: 16px; 1443 1462 line-height: 1.4; -
trunk/src/wp-admin/css/forms.css
r38700 r38880 595 595 white-space: nowrap; 596 596 text-align: left; 597 } 598 599 .ui-autocomplete li.ui-state-focus { 597 cursor: pointer; 598 } 599 600 /* Colors for the wplink toolbar autocomplete. */ 601 .ui-autocomplete .ui-state-focus { 600 602 background-color: #ddd; 601 cursor: pointer; 603 } 604 605 /* Colors for the tags autocomplete. */ 606 .wp-tags-autocomplete .ui-state-focus { 607 background-color: #0073aa; 608 color: #fff; 602 609 } 603 610 -
trunk/src/wp-admin/css/ie.css
r38672 r38880 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 } 448 449 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 450 outline: 1px solid #5b9dd9; 447 451 } 448 452 -
trunk/src/wp-admin/css/press-this.css
r38152 r38880 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 { … … 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; … … 829 796 830 797 @media (max-width: 600px) { 831 .tagchecklist span {798 .tagchecklist > span { 832 799 margin-bottom: 15px; 833 800 font-size: 16px; … … 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 } 850 851 .tagchecklist .ntdelbutton:before { 816 } 817 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; 858 color: #9ea7af; 859 font: 400 16px/1 dashicons; 824 -webkit-border-radius: 50%; 825 border-radius: 50%; 826 background: transparent; 827 color: #0073aa; 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; 867 } 868 834 .tagchecklist .ntdelbutton:focus { 835 outline: 0; 836 } 837 838 .tagchecklist .ntdelbutton:hover .remove-tag-icon:before, 839 .tagchecklist .ntdelbutton:focus .remove-tag-icon:before { 840 color: #c00; 841 } 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 } 869 851 870 852 /* THE TAG CLOUD. */ … … 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 … … 2202 2185 white-space: nowrap; 2203 2186 text-align: left; 2204 } 2205 2206 .ui-autocomplete li.ui-state-focus { 2187 cursor: pointer; 2188 } 2189 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 } -
trunk/src/wp-admin/includes/class-wp-press-this.php
r38705 r38880 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 } -
trunk/src/wp-admin/includes/meta-boxes.php
r38797 r38880 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 -
trunk/src/wp-admin/js/tags-box.js
r38797 r38880 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 } 98 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 } 109 110 tagBox.userAction = 'remove'; 99 111 tagBox.parseTags( this ); 100 112 } … … 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 … … 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 } … … 149 170 150 171 $( 'a', r ).click( function() { 172 tagBox.userAction = 'add'; 151 173 tagBox.flushTags( $( '#' + tax ), this ); 152 174 return false; … … 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'); … … 165 218 166 219 $( '.tagadd', ajaxtag ).click( function() { 220 tagBox.userAction = 'add'; 167 221 tagBox.flushTags( $( this ).closest( '.tagsdiv' ) ); 168 222 }); … … 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(); … … 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 event and attach a 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 } -
trunk/src/wp-admin/js/tags-suggest.js
r38797 r38880 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 ) { … … 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; … … 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 … … 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 } ); … … 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 ) { … … 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 } … … 161 177 $( this ).find( '[aria-selected="true"]' ).removeAttr( 'aria-selected' ); 162 178 }); 163 179 164 180 return this; 165 181 }; -
trunk/src/wp-includes/script-loader.php
r38832 r38880 539 539 did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array( 540 540 'tagDelimiter' => _x( ',', 'tag delimiter' ), 541 'removeTerm' => __( 'Remove term:' ), 542 'termSelected' => __( 'Term selected.' ), 543 'termAdded' => __( 'Term added.' ), 544 'termRemoved' => __( 'Term removed.' ), 541 545 ) ); 542 546
Note: See TracChangeset
for help on using the changeset viewer.