WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/10/2016 07:30:20 PM (4 years ago)
Author:
ocean90
Message:

Accessibility: Add aria-button-if-js class to links in the media list table that behave like buttons when JavaScript is on.

Props joedolson, afercia.
See #26504.
Fixes #36555.

File:
1 edited

Legend:

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

    r37952 r38031  
    477477            $title = _draft_or_post_title( $post->post_parent );
    478478            $parent_type = get_post_type_object( $parent->post_type );
    479            
     479
    480480            if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
    481481?>
     
    508508                $title = _draft_or_post_title( $post->post_parent );
    509509                printf(
    510                     '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
     510                    '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>',
    511511                    $post->ID,
    512512                    /* translators: %s: attachment title */
     
    660660                if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
    661661                    $actions['trash'] = sprintf(
    662                         '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
     662                        '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
    663663                        wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ),
    664664                        /* translators: %s: attachment title */
     
    669669                    $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
    670670                    $actions['delete'] = sprintf(
    671                         '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>',
     671                        '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>',
    672672                        wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ),
    673673                        $delete_ays,
     
    688688            if ( current_user_can( 'edit_post', $post->ID ) ) {
    689689                $actions['attach'] = sprintf(
    690                     '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
     690                    '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>',
    691691                    $post->ID,
    692692                    /* translators: %s: attachment title */
     
    709709                if ( $this->is_trash ) {
    710710                    $actions['untrash'] = sprintf(
    711                         '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
     711                        '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
    712712                        wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ),
    713713                        /* translators: %s: attachment title */
     
    717717                } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
    718718                    $actions['trash'] = sprintf(
    719                         '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
     719                        '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
    720720                        wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ),
    721721                        /* translators: %s: attachment title */
     
    727727                    $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
    728728                    $actions['delete'] = sprintf(
    729                         '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>',
     729                        '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>',
    730730                        wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ),
    731731                        $delete_ays,
Note: See TracChangeset for help on using the changeset viewer.