Ticket #42390: 42390.diff
| File 42390.diff, 6.8 KB (added by , 7 years ago) |
|---|
-
src/js/_enqueues/admin/post.js
1040 1040 }); 1041 1041 1042 1042 /** 1043 * Adds screen reader text to the title promptwhen needed.1043 * Adds screen reader text to the title label when needed. 1044 1044 * 1045 * Use the 'screen-reader-text' class to emulate a placeholder attribute 1046 * and hide the label when entering a value. 1047 * 1045 1048 * @param {string} id Optional. HTML ID to add the screen reader helper text to. 1046 1049 * 1047 1050 * @global … … 1048 1051 * 1049 1052 * @returns void 1050 1053 */ 1051 window.wptitlehint = function( id) {1054 window.wptitlehint = function( id ) { 1052 1055 id = id || 'title'; 1053 1056 1054 var title = $( '#' + id), titleprompt = $('#' + id + '-prompt-text');1057 var title = $( '#' + id ), titleprompt = $( '#' + id + '-prompt-text' ); 1055 1058 1056 if ( '' === title.val() ) 1057 titleprompt.removeClass('screen-reader-text'); 1059 if ( '' === title.val() ) { 1060 titleprompt.removeClass( 'screen-reader-text' ); 1061 } 1058 1062 1059 titleprompt.click(function(){ 1060 $(this).addClass('screen-reader-text'); 1061 title.focus(); 1062 }); 1063 title.on( 'input', function() { 1064 if ( '' === this.value ) { 1065 titleprompt.removeClass( 'screen-reader-text' ); 1066 return; 1067 } 1063 1068 1064 title.blur(function(){ 1065 if ( '' === this.value ) 1066 titleprompt.removeClass('screen-reader-text'); 1067 }).focus(function(){ 1068 titleprompt.addClass('screen-reader-text'); 1069 }).keydown(function(e){ 1070 titleprompt.addClass('screen-reader-text'); 1071 $(this).unbind(e); 1072 }); 1069 titleprompt.addClass( 'screen-reader-text' ); 1070 } ); 1073 1071 }; 1074 1072 1075 1073 wptitlehint(); -
src/js/_enqueues/wp/dashboard.js
173 173 // Change the QuickPost action to the publish value. 174 174 $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); 175 175 176 /**177 * Adds accessibility context to inputs.178 *179 * Use the 'screen-reader-text' class to hide the label when entering a value.180 * Apply it when the input is not empty or the input has focus.181 *182 * @returns {void}183 */184 $('#title, #tags-input, #content').each( function() {185 var input = $(this), prompt = $('#' + this.id + '-prompt-text');186 187 if ( '' === this.value ) {188 prompt.removeClass('screen-reader-text');189 }190 191 prompt.click( function() {192 $(this).addClass('screen-reader-text');193 input.focus();194 });195 196 input.blur( function() {197 if ( '' === this.value ) {198 prompt.removeClass('screen-reader-text');199 }200 });201 202 input.focus( function() {203 prompt.addClass('screen-reader-text');204 });205 });206 207 176 $('#quick-press').on( 'click focusin', function() { 208 177 wpActiveEditor = 'content'; 209 178 }); -
src/wp-admin/css/dashboard.css
599 599 margin: 12px; 600 600 } 601 601 602 #dashboard_quick_press .drafts, 603 #dashboard_quick_press .easy-blogging { 602 #dashboard_quick_press .drafts { 604 603 padding: 10px 0 0; 605 604 } 606 605 607 606 /* Dashboard Quick Draft - Form styling */ 608 607 609 input#save-post { 610 float: left; 608 #dashboard_quick_press label { 609 display: inline-block; 610 margin-bottom: 4px; 611 611 } 612 612 613 form.initial-form.quickpress-open label.prompt {614 font-style: normal;615 }616 617 form.initial-form.quickpress-open input#title {618 height: auto;619 }620 621 613 #dashboard_quick_press input, 622 614 #dashboard_quick_press textarea { 623 615 box-sizing: border-box; … … 624 616 margin: 0; 625 617 } 626 618 627 #dashboard_quick_press textarea {628 resize: vertical;629 }630 631 619 #dashboard-widgets .postbox form .submit { 632 620 margin: -39px 0; 633 621 float: right; … … 637 625 margin-top: 12px; 638 626 } 639 627 640 #title-wrap #title-prompt-text,641 .textarea-wrap #content-prompt-text {642 color: #72777c;643 }644 645 #title-wrap #title-prompt-text {646 font-size: 1.1em;647 padding: 7px 8px;648 }649 650 .input-text-wrap,651 .textarea-wrap {652 position: relative;653 }654 655 .input-text-wrap .prompt,656 .textarea-wrap .prompt {657 position: absolute;658 }659 660 .textarea-wrap #content-prompt-text {661 font-size: 1.1em;662 padding: 7px 8px;663 }664 665 .textarea-wrap textarea#content {666 margin: 0 0 8px;667 padding: 6px 7px;668 }669 670 628 #quick-press textarea#content { 671 629 min-height: 90px; 672 630 max-height: 1300px; 631 margin: 0 0 8px; 632 padding: 6px 7px; 673 633 resize: none; 674 634 } 675 635 … … 1000 960 font-size: 13px; 1001 961 } 1002 962 1003 /* QuickDraft */1004 1005 #title-wrap label,1006 #description-wrap label {1007 cursor: text;1008 }1009 1010 #title-wrap #title {1011 padding: 2px 6px;1012 font-size: 1.3em;1013 outline: none;1014 }1015 1016 #title-wrap #title-prompt-text {1017 font-size: 1.1em;1018 padding: 5px 8px;1019 }1020 1021 963 /* Feeds */ 1022 964 .rss-widget ul { 1023 965 margin: 0; -
src/wp-admin/edit-form-advanced.php
477 477 * 478 478 * @since 3.1.0 479 479 * 480 * @param string $text Placeholder text. Default ' Enter title here'.480 * @param string $text Placeholder text. Default 'Add title'. 481 481 * @param WP_Post $post Post object. 482 482 */ 483 $title_placeholder = apply_filters( 'enter_title_here', __( ' Enter title here' ), $post );483 $title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post ); 484 484 ?> 485 485 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label> 486 486 <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" /> -
src/wp-admin/includes/dashboard.php
519 519 <?php endif; ?> 520 520 521 521 <div class="input-text-wrap" id="title-wrap"> 522 <label class="screen-reader-text prompt" for="title" id="title-prompt-text"> 523 522 <label for="title"> 524 523 <?php 525 524 /** This filter is documented in wp-admin/edit-form-advanced.php */ 526 525 echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); … … 530 529 </div> 531 530 532 531 <div class="textarea-wrap" id="description-wrap"> 533 <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label>534 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>532 <label for="content"><?php _e( 'Content' ); ?></label> 533 <textarea name="content" id="content" placeholder="<?php esc_attr_e( 'What’s on your mind?' ); ?>" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea> 535 534 </div> 536 535 537 536 <p class="submit">