WordPress.org

Make WordPress Core

Changeset 21310


Ignore:
Timestamp:
07/23/2012 11:46:27 PM (8 years ago)
Author:
azaozz
Message:

Make it possible to tab out of the plugin and theme editors textareas by pressing Esc followed by Tab, fixes #21347

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/common.dev.js

    r21305 r21310  
    322322    // tab in textareas
    323323    $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
    324         if ( e.keyCode != 9 )
    325             return true;
    326 
    327         var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
     324        var el = e.target, selStart, selEnd, val, scroll, sel;
     325
     326        if ( e.keyCode == 27 ) { // escape key
     327            $(el).data('tab-out', true);
     328            return;
     329        }
     330
     331        if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey ) // tab key
     332            return;
     333
     334        if ( $(el).data('tab-out') ) {
     335            $(el).data('tab-out', false);
     336            return;
     337        }
     338
     339        selStart = el.selectionStart;
     340        selEnd = el.selectionEnd;
     341        val = el.value;
    328342
    329343        try {
  • trunk/wp-admin/plugin-editor.php

    r20525 r21310  
    227227<form name="template" id="template" action="plugin-editor.php" method="post">
    228228    <?php wp_nonce_field('edit-plugin_' . $file) ?>
    229         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
     229        <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description" tabindex="1"><?php echo $content ?></textarea>
     230        <span id="newcontent-description" class="screen-reader-text"><?php _e('Content of the edited file. The Tab key enters a tab character, to move below this area, press the Esc key followed by the Tab key. Shift + Tab works as expected.'); ?></span>
    230231        <input type="hidden" name="action" value="update" />
    231232        <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
     
    257258</div>
    258259<script type="text/javascript">
    259 /* <![CDATA[ */
    260260jQuery(document).ready(function($){
    261261    $('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); });
    262262    $('#newcontent').scrollTop( $('#scrollto').val() );
    263263});
    264 /* ]]> */
    265264</script>
    266265<?php
  • trunk/wp-admin/theme-editor.php

    r20844 r21310  
    199199    <form name="template" id="template" action="theme-editor.php" method="post">
    200200    <?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?>
    201          <div><textarea cols="70" rows="30" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
    202          <input type="hidden" name="action" value="update" />
    203          <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
    204          <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
    205          <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
    206          </div>
     201        <div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description" tabindex="1"><?php echo $content ?></textarea>
     202        <span id="newcontent-description" class="screen-reader-text"><?php _e('Content of the edited file. The Tab key enters a tab character, to move below this area, press the Esc key followed by the Tab key. Shift + Tab works as expected.'); ?></span>
     203        <input type="hidden" name="action" value="update" />
     204        <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
     205        <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
     206        <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
     207        </div>
    207208    <?php if ( ! empty( $functions ) ) : ?>
    208209        <div id="documentation" class="hide-if-no-js">
Note: See TracChangeset for help on using the changeset viewer.