WordPress.org

Make WordPress Core

Changeset 42759


Ignore:
Timestamp:
02/26/2018 11:09:57 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Media: Remove unnecessary aria-required attribute from legacy (pre-3.5.0) media functions, added in [7888].

At the time, having both required and aria-required meant a wider range of support for browsers and assistive technology. Today, it's safe to use just required.

Props shital-patel, afercia, audrasjb.
Fixes #43415.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r42449 r42759  
    16571657        $required      = $field['required'] ? '<span class="required">*</span>' : '';
    16581658        $required_attr = $field['required'] ? ' required' : '';
    1659         $aria_required = $field['required'] ? " aria-required='true'" : '';
    16601659        $class         = $id;
    16611660        $class        .= $field['required'] ? ' form-required' : '';
     
    16701669            }
    16711670            // Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
    1672             $item .= "<textarea id='$name' name='$name'{$required_attr}{$aria_required}>" . $field['value'] . '</textarea>';
     1671            $item .= "<textarea id='$name' name='$name'{$required_attr}>" . $field['value'] . '</textarea>';
    16731672        } else {
    1674             $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'{$required_attr}{$aria_required} />";
     1673            $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'{$required_attr} />";
    16751674        }
    16761675        if ( ! empty( $field['helps'] ) ) {
     
    18301829        $required      = $field['required'] ? '<span class="required">*</span>' : '';
    18311830        $required_attr = $field['required'] ? ' required' : '';
    1832         $aria_required = $field['required'] ? " aria-required='true'" : '';
    18331831        $class         = 'compat-field-' . $id;
    18341832        $class        .= $field['required'] ? ' form-required' : '';
     
    18451843                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
    18461844            }
    1847             $item .= "<textarea id='$id_attr' name='$name'{$required_attr}{$aria_required}>" . $field['value'] . '</textarea>';
     1845            $item .= "<textarea id='$id_attr' name='$name'{$required_attr}>" . $field['value'] . '</textarea>';
    18481846        } else {
    1849             $item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly{$required_attr}{$aria_required} />";
     1847            $item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly{$required_attr} />";
    18501848        }
    18511849        if ( ! empty( $field['helps'] ) ) {
     
    27542752                <span class="alignright" id="status_img"></span>
    27552753            </th>
    2756             <td class="field"><input id="src" name="src" value="" type="text" required aria-required="true" onblur="addExtImage.getImageData()" /></td>
     2754            <td class="field"><input id="src" name="src" value="" type="text" required onblur="addExtImage.getImageData()" /></td>
    27572755        </tr>
    27582756
     
    27612759                <label for="title"><span class="alignleft">' . __( 'Title' ) . '</span> <span class="required">*</span></label>
    27622760            </th>
    2763             <td class="field"><input id="title" name="title" value="" type="text" required aria-required="true" /></td>
     2761            <td class="field"><input id="title" name="title" value="" type="text" required /></td>
    27642762        </tr>
    27652763
     
    27702768                <label for="alt"><span class="alignleft">' . __( 'Alternative Text' ) . '</span></label>
    27712769            </th>
    2772             <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
     2770            <td class="field"><input id="alt" name="alt" value="" type="text" required />
    27732771            <p class="help">' . __( 'Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;' ) . '</p></td>
    27742772        </tr>
Note: See TracChangeset for help on using the changeset viewer.