WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/24/2017 03:59:56 PM (4 years ago)
Author:
afercia
Message:

Accessibility: CodeMirror editing areas minor improvements.

  • properly labels all the code editor areas (Theme/Plugin, Custom HTML widget, Additional CSS), whether CodeMirror is enabled or disabled
  • adds role="textbox" and aria-multiline="true" to the CodeMirror editing area to allow assistive technologies properly identify it as a textarea
  • standardizes the "keyboard trap" help text across the admin and keeps it as a list for better readability
  • use the Help text elements as target for aria-describedby, to make screen readers read out the help text when focusing the editors
  • fixes the aria-expanded attribute usage in the Customizer "Additional CSS" help toggle
  • moves focus to the CodeMirror editing area when clicking on the associated label
  • in the Plugin editor screen: changes a <big> element to <h2> for better semantics and consistency with the Theme editor screen
  • also, removes a few textdomain leftovers, see better-code-editing and default

Props westonruter, melchoyce, afercia.
Fixes #41872.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugin-editor.php

    r41560 r41586  
    196196        '<p>' . __('Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
    197197        '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' .
    198         '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' .
     198        '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
     199        '<ul>' .
     200        '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
     201        '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
     202        '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
     203        '</ul>' .
    199204        '<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' .
    200205        ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
     
    256261<div class="fileedit-sub">
    257262<div class="alignleft">
    258 <big><?php
     263<h2>
     264    <?php
    259265    if ( is_plugin_active( $plugin ) ) {
    260266        if ( is_writeable( $real_file ) ) {
     
    274280        }
    275281    }
    276     ?></big>
     282    ?>
     283</h2>
    277284</div>
    278285<div class="alignright">
     
    322329<form name="template" id="template" action="plugin-editor.php" method="post">
    323330    <?php wp_nonce_field('edit-plugin_' . $file) ?>
    324         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
    325         <input type="hidden" name="action" value="update" />
    326         <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
    327         <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
    328         <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
     331        <div>
     332            <label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label>
     333            <textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea>
     334            <input type="hidden" name="action" value="update" />
     335            <input type="hidden" name="file" value="<?php echo esc_attr( $file ); ?>" />
     336            <input type="hidden" name="plugin" value="<?php echo esc_attr( $plugin ); ?>" />
     337            <input type="hidden" name="scrollto" id="scrollto" value="<?php echo esc_attr( $scrollto ); ?>" />
    329338        </div>
    330339        <?php if ( !empty( $docs_select ) ) : ?>
Note: See TracChangeset for help on using the changeset viewer.