Ticket #6914: wp-6914.diff

File wp-6914.diff, 11.9 kB (added by MarcoZ, 5 months ago)

Add aria-required attribute to fields that are styled with the form-required style, or whose required state is indicated by an array parameter.

  • wp-admin/edit-category-form.php

    old new  
    2626        <table class="form-table"> 
    2727                <tr class="form-field form-required"> 
    2828                        <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th> 
    29                         <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /><br /> 
     29                        <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br /> 
    3030            <?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td> 
    3131                </tr> 
    3232                <tr class="form-field"> 
  • wp-admin/edit-form-advanced.php

    old new  
    222222<div id="category-adder" class="wp-hidden-children"> 
    223223        <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> 
    224224        <p id="category-add" class="wp-hidden-child"> 
    225                 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> 
     225                <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 
    226226                <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 
    227227                <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 
    228228                <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 
  • wp-admin/edit-link-category-form.php

    old new  
    2626        <table class="form-table"> 
    2727                <tr class="form-field form-required"> 
    2828                        <th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th> 
    29                         <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td> 
     29                        <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td> 
    3030                </tr> 
    3131                <tr class="form-field"> 
    3232                        <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th> 
  • wp-admin/edit-link-form.php

    old new  
    105105        <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> 
    106106        <p id="link-category-add" class="wp-hidden-child"> 
    107107                <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label> 
    108                 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" /> 
     108                <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" /> 
    109109                <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" /> 
    110110                <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> 
    111111                <span id="category-ajax-response"></span> 
  • wp-admin/edit-tag-form.php

    old new  
    2626        <table class="form-table"> 
    2727                <tr class="form-field form-required"> 
    2828                        <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th> 
    29                         <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" /> 
     29                        <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" aria-required="true" /> 
    3030            <p><?php _e('The name is how the tag appears on your site.'); ?></p></td> 
    3131                </tr> 
    3232                <tr class="form-field"> 
  • wp-admin/includes/media.php

    old new  
    703703                } 
    704704 
    705705                $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : ''; 
     706                $aria_required = $field['required'] ? ' aria-required="true" ' : ''; 
    706707                $class  = $id; 
    707708                $class .= $field['required'] ? ' form-required' : ''; 
    708709 
     
    710711                if ( !empty($field[$field['input']]) ) 
    711712                        $item .= $field[$field['input']]; 
    712713                elseif ( $field['input'] == 'textarea' ) { 
    713                         $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . "</textarea>"; 
     714                        $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>"; 
    714715                } else { 
    715                         $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "' />"; 
     716                        $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>"; 
    716717                } 
    717718                if ( !empty($field['helps']) ) 
    718719                        $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>'; 
     
    10851086                                <span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span> 
    10861087                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    10871088                        </th> 
    1088                         <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td> 
     1089                        <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text" aria-required="true"></td> 
    10891090                </tr> 
    10901091                <tr> 
    10911092                        <th valign="top" scope="row" class="label"> 
    10921093                                <span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span> 
    10931094                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    10941095                        </th> 
    1095                         <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text"></td> 
     1096                        <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text" aria-required="true"></td> 
    10961097                </tr> 
    10971098                <tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr> 
    10981099                <tr class="align"> 
     
    11261127                                <span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span> 
    11271128                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11281129                        </th> 
    1129                         <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td> 
     1130                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 
    11301131                </tr> 
    11311132                <tr> 
    11321133                        <th valign="top" scope="row" class="label"> 
    11331134                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 
    11341135                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11351136                        </th> 
    1136                         <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td> 
     1137                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 
    11371138                </tr> 
    11381139                <tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr> 
    11391140                <tr> 
     
    11541155                                <span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span> 
    11551156                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11561157                        </th> 
    1157                         <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td> 
     1158                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 
    11581159                </tr> 
    11591160                <tr> 
    11601161                        <th valign="top" scope="row" class="label"> 
    11611162                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 
    11621163                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11631164                        </th> 
    1164                         <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td> 
     1165                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 
    11651166                </tr> 
    11661167                <tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr> 
    11671168                <tr> 
     
    11821183                                <span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span> 
    11831184                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11841185                        </th> 
    1185                         <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td> 
     1186                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td> 
    11861187                </tr> 
    11871188                <tr> 
    11881189                        <th valign="top" scope="row" class="label"> 
    11891190                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span> 
    11901191                                <span class="alignright"><abbr title="required" class="required">*</abbr></span> 
    11911192                        </th> 
    1192                         <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td> 
     1193                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td> 
    11931194                </tr> 
    11941195                <tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr> 
    11951196                <tr> 
  • wp-admin/users.php

    old new  
    405405<table class="form-table"> 
    406406        <tr class="form-field form-required"> 
    407407                <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th> 
    408                 <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td> 
     408                <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td> 
    409409        </tr> 
    410410        <tr class="form-field"> 
    411411                <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th> 
  • wp-content/themes/default/comments.php

    old new  
    7878 
    7979<?php else : ?> 
    8080 
    81 <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> 
     81<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /> 
    8282<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p> 
    8383 
    84 <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> 
     84<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /> 
    8585<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p> 
    8686 
    8787<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />