Make WordPress Core


Ignore:
Timestamp:
10/07/2024 04:55:26 PM (2 years ago)
Author:
joedolson
Message:

Editor: A11y: Fix tab order, state, and focus in classic editor.

Remove code that forced focus to skip from the title field to the editor. Add link to skip to editor to give the user control over their path. Set aria-pressed on editor selector buttons to communicate which editor is enabled. Make focus state visible on unselected editor button. Remove wp_keep_scroll_position flag used for IE compatibility. Add role="presentation" to table used as status info bar.

This addresses a long-standing accessibility problem in the classic editor which created a confusing keyboard navigation path by skipping all content between the title field and the content editor.

Props afercia, rcreators, benjamin_zekavica, sharonaustin, joedolson.
Fixes #29838.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r59161 r59188  
    547547        <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
    548548        <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
     549        <a href="#content" class="button-secondary screen-reader-text skiplink" onclick="if (tinymce) { tinymce.execCommand( 'mceFocus', false, 'content' ); }"><?php esc_html_e( 'Skip to Editor' ); ?></a>
    549550</div>
    550551        <?php
    … …  
    622623                        '_content_editor_dfw' => $_content_editor_dfw,
    623624                        'drag_drop_upload'    => true,
    624                         'tabfocus_elements'   => 'content-html,save-post',
    625625                        'editor_height'       => 300,
    626626                        'tinymce'             => array(
    … …  
    628628                                'wp_autoresize_on'        => $_wp_editor_expand,
    629629                                'add_unload_trigger'      => false,
    630                                 'wp_keep_scroll_position' => ! $is_IE,
    631630                        ),
    632631                )
    633632        );
    634633        ?>
    635 <table id="post-status-info"><tbody><tr>
     634<table id="post-status-info" role="presentation"><tbody><tr>
    636635        <td id="wp-word-count" class="hide-if-no-js">
    637636        <?php
Note: See TracChangeset for help on using the changeset viewer.