Make WordPress Core

Ticket #33704: 33704-focus.diff

File 33704-focus.diff, 5.4 KB (added by akibjorklund, 8 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    553553        $title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post );
    554554        ?>
    555555        <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
    556         <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
     556        <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off"<?php if ( '' === $post->post_title ) { ?> class="wp-initial-focus"<?php } ?> />
    557557</div>
    558558<?php
    559559/**
     
    738738<?php
    739739if ( post_type_supports( $post_type, 'comments' ) )
    740740        wp_comment_reply();
    741 ?>
    742 
    743 <?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
    744 <script type="text/javascript">
    745 try{document.post.title.focus();}catch(e){}
    746 </script>
    747 <?php endif; ?>
  • src/wp-admin/edit-form-comment.php

     
    4141<tbody>
    4242<tr>
    4343        <td class="first"><label for="name"><?php _e( 'Name:' ); ?></label></td>
    44         <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
     44        <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" class="wp-initial-focus" /></td>
    4545</tr>
    4646<tr>
    4747        <td class="first"><label for="email"><?php _e( 'Email:' ); ?></label></td>
     
    200200</div><!-- /post-body -->
    201201</div>
    202202</div>
    203 </form>
    204 
    205 <?php if ( ! wp_is_mobile() ) : ?>
    206 <script type="text/javascript">
    207 try{document.post.name.focus();}catch(e){}
    208 </script>
    209 <?php endif;
     203</form>
     204 No newline at end of file
  • src/wp-admin/edit-tag-form.php

     
    125125        <table class="form-table">
    126126                <tr class="form-field form-required term-name-wrap">
    127127                        <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
    128                         <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
     128                        <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" class="wp-initial-focus" />
    129129                        <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    130130                </tr>
    131131<?php if ( !global_terms_enabled() ) { ?>
     
    263263submit_button( __('Update') );
    264264?>
    265265</form>
    266 </div>
    267 
    268 <?php if ( ! wp_is_mobile() ) : ?>
    269 <script type="text/javascript">
    270 try{document.forms.edittag.name.focus();}catch(e){}
    271 </script>
    272 <?php endif;
     266</div>
     267 No newline at end of file
  • src/wp-admin/edit-tags.php

     
    411411
    412412<div class="form-field form-required term-name-wrap">
    413413        <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
    414         <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
     414        <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" class="wp-initial-focus" />
    415415        <p><?php _e('The name is how it appears on your site.'); ?></p>
    416416</div>
    417417<?php if ( ! global_terms_enabled() ) : ?>
     
    615615</div><!-- /col-container -->
    616616</div><!-- /wrap -->
    617617
    618 <?php if ( ! wp_is_mobile() ) : ?>
    619 <script type="text/javascript">
    620 try{document.forms.addtag['tag-name'].focus();}catch(e){}
    621 </script>
    622618<?php
    623 endif;
    624619
    625620$wp_list_table->inline_edit();
    626621
  • src/wp-admin/install.php

     
    390390                }
    391391                break;
    392392}
    393 
    394 if ( ! wp_is_mobile() ) {
    395         ?>
    396 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
    397         <?php
     393?>
     394<script type="text/javascript">
     395var width = Math.max( document.documentElement.clientWidth, window.innerWidth || 0 );
     396if ( width > 782 ) {
     397        var t = document.getElementById( 'weblog_title' );
     398        if ( t ) {
     399                t.focus();
     400        }
    398401}
    399 
     402</script>
     403<?php
    400404wp_print_scripts( $scripts_to_print );
    401405?>
    402406<script type="text/javascript">
  • src/wp-admin/js/common.js

     
    913913        $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 );
    914914
    915915        // Set initial focus on a specific element.
    916         $( '.wp-initial-focus' ).focus();
     916        if ( ! wpResponsiveActive ) {
     917                $( '.wp-initial-focus' ).focus();
     918        }
    917919});
    918920
    919921// Fire a custom jQuery event at the end of window resize