Accessibility: Change the media upload "Dismiss error" link to a button.

For better accessibility and semantics, user interface controls that perform an
action should be buttons. Links should exclusively be used for navigation.

Props Cheffheid, audrasjb.
Fixes #38671.

Built from https://develop.svn.wordpress.org/trunk@42784


git-svn-id: http://core.svn.wordpress.org/trunk@42614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2018-03-05 15:33:33 +00:00
parent 084b48e1ba
commit 64634898c2
6 changed files with 6 additions and 8 deletions

View File

@ -90,7 +90,7 @@ if ( isset( $_REQUEST['post_id'] ) ) {
$id = media_handle_upload( 'async-upload', $post_id ); $id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) ) { if ( is_wp_error( $id ) ) {
echo '<div class="error-div error"> echo '<div class="error-div error">
<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __( 'Dismiss' ) . '</a> <button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __( 'Dismiss' ) . '</button>
<strong>' . sprintf( __( '&#8220;%s&#8221; has failed to upload.' ), esc_html( $_FILES['async-upload']['name'] ) ) . '</strong><br />' . <strong>' . sprintf( __( '&#8220;%s&#8221; has failed to upload.' ), esc_html( $_FILES['async-upload']['name'] ) ) . '</strong><br />' .
esc_html( $id->get_error_message() ) . '</div>'; esc_html( $id->get_error_message() ) . '</div>';
exit; exit;

View File

@ -211,8 +211,7 @@
padding: 10px 14px 10px 0; padding: 10px 14px 10px 0;
} }
.media-item .error-div a.dismiss { .media-item .error-div button.dismiss {
display: block;
float: left; float: left;
margin: 0 15px 0 10px; margin: 0 15px 0 10px;
} }

File diff suppressed because one or more lines are too long

View File

@ -211,8 +211,7 @@
padding: 10px 0 10px 14px; padding: 10px 0 10px 14px;
} }
.media-item .error-div a.dismiss { .media-item .error-div button.dismiss {
display: block;
float: right; float: right;
margin: 0 10px 0 15px; margin: 0 10px 0 15px;
} }

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-42783'; $wp_version = '5.0-alpha-42784';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.