Skip to:
Content

BuddyPress.org

Changeset 11606


Ignore:
Timestamp:
06/22/2017 08:09:27 PM (2 years ago)
Author:
djpaul
Message:

HTML <a> elements should never have title attributes.

Accessible support is too inconsistent across software and platforms.
In a small number of places (mainly legacy templates) where the link text was a meaningless value, the attribute was swapped out for aria-label, which reliably overides the link text readout.

Props rianrietveld

Location:
trunk/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-notifications.php

    r11022 r11606  
    9595         * @param int    $user_id         ID of the user who inited the interaction.
    9696         */
    97         $return = apply_filters( 'bp_activity_' . $amount . '_' . $action_filter . '_notification', '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>', $link, (int) $total_items, $activity_id, $user_id );
     97        $return = apply_filters( 'bp_activity_' . $amount . '_' . $action_filter . '_notification', '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', $link, (int) $total_items, $activity_id, $user_id );
    9898    } else {
    9999
  • trunk/src/bp-activity/classes/class-bp-activity-list-table.php

    r11414 r11606  
    593593                $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
    594594            } else {
    595                 $actions['reply'] = sprintf( '<span class="form-input-tip" title="%s">%s</span>', __( 'Replies are disabled for this activity item', 'buddypress' ), __( 'Replies disabled', 'buddypress' ) );
     595                $actions['reply'] = sprintf( '<span class="form-input-tip">%s</span>', __( 'Replies disabled', 'buddypress' ) );
    596596            }
    597597
     
    707707            // If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble.
    708708            if ( $comment_count ) {
    709                 $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
    710                 printf( '<a href="%1$s" title="%2$s" class="post-com-count post-com-count-approved"><span class="comment-count comment-count-approved">%3$s</span></a>', esc_url( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
     709                printf( '<a href="%1$s" class="post-com-count post-com-count-approved"><span class="comment-count comment-count-approved">%2$s</span></a>', esc_url( $root_activity_url ), number_format_i18n( $comment_count ) );
    711710            }
    712711
  • trunk/src/bp-core/admin/bp-core-admin-settings.php

    r11593 r11606  
    272272    <?php if ( false === $file_exists ) : ?>
    273273
    274         <a class="button" href="<?php bp_admin_url( 'admin.php?page=bb-forums-setup&repair=1' ); ?>" title="<?php esc_attr_e( 'Attempt to save a new config file.', 'buddypress' ); ?>"><?php _e( 'Repair', 'buddypress' ) ?></a>
     274        <a class="button" href="<?php bp_admin_url( 'admin.php?page=bb-forums-setup&repair=1' ); ?>"><?php _e( 'Repair', 'buddypress' ) ?></a>
    275275        <span class="attention"><?php _e( 'File does not exist', 'buddypress' ); ?></span>
    276276
  • trunk/src/bp-core/classes/class-bp-core-user.php

    r11447 r11606  
    158158            $this->user_url  = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
    159159            $this->fullname  = esc_attr( $this->profile_data[$full_name_field_name]['field_data'] );
    160             $this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
     160            $this->user_link = "<a href='{$this->user_url}'>{$this->fullname}</a>";
    161161            $this->email     = esc_attr( $this->profile_data['user_email'] );
    162162        } else {
  • trunk/src/bp-forums/bp-forums-template.php

    r10955 r11606  
    26532653         * @param string $value HTML link for the poster's name.
    26542654         */
    2655         return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' );
     2655        return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . esc_url( $link ) . '">' . esc_html( $topic_template->post->poster_name ) . '</a>' );
    26562656    }
    26572657
  • trunk/src/bp-groups/bp-groups-notifications.php

    r11557 r11606  
    394394                     * @param string $notification_link The permalink for notification.
    395395                     */
    396                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
     396                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
    397397                } else {
    398398
     
    492492                     * @param string $notification_link The permalink for notification.
    493493                     */
    494                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
     494                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
    495495                } else {
    496496
     
    581581                     * @param string $notification_link The permalink for notification.
    582582                     */
    583                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name );
     583                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name );
    584584                } else {
    585585
     
    667667                     * @param string $notification_link The permalink for notification.
    668668                     */
    669                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     669                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
    670670                } else {
    671671                    /**
     
    749749                     * @param string $notification_link The permalink for notification.
    750750                     */
    751                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     751                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
    752752                } else {
    753753                    /**
     
    831831                     * @param string $notification_link The permalink for notification.
    832832                     */
    833                     return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Group Invites', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     833                    return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
    834834                } else {
    835835                    /**
  • trunk/src/bp-groups/classes/class-bp-groups-invite-template.php

    r11363 r11606  
    237237        $this->invite->user->email        = $this->invite->user->user_email;
    238238        $this->invite->user->user_url     = bp_core_get_user_domain( $user_id, $this->invite->user->user_nicename, $this->invite->user->user_login );
    239         $this->invite->user->user_link    = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
     239        $this->invite->user->user_link    = "<a href='{$this->invite->user->user_url}'>{$this->invite->user->fullname}</a>";
    240240        $this->invite->user->last_active  = bp_core_get_last_activity( $this->invite->user->last_activity, __( 'active %s', 'buddypress' ) );
    241241
  • trunk/src/bp-members/classes/class-bp-members-list-table.php

    r10882 r11606  
    309309        );
    310310
    311         echo $avatar . sprintf( '<strong><a href="%1$s" class="edit" title="%2$s">%3$s</a></strong><br/>', esc_url( $activate_link ), esc_attr__( 'Activate', 'buddypress' ), $signup_object->user_login );
     311        echo $avatar . sprintf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), $signup_object->user_login );
    312312
    313313        $actions = array();
  • trunk/src/bp-members/classes/class-bp-members-ms-list-table.php

    r10882 r11606  
    302302        );
    303303
    304         echo $avatar . sprintf( '<strong><a href="%1$s" class="edit" title="%2$s">%3$s</a></strong><br/>', esc_url( $activate_link ), esc_attr__( 'Activate', 'buddypress' ), $signup_object->user_login );
     304        echo $avatar . sprintf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $activate_link ), $signup_object->user_login );
    305305
    306306        $actions = array();
  • trunk/src/bp-messages/bp-messages-notifications.php

    r11578 r11606  
    5454        if ( 'string' === $format ) {
    5555            if ( ! empty( $link ) ) {
    56                 $return = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>';
     56                $return = '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>';
    5757            } else {
    5858                $return = esc_html( $text );
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r11498 r11606  
    14961496                _e( 'Error joining group', 'buddypress' );
    14971497            } else {
    1498                 echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
     1498                echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button leave-group" rel="leave" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    14991499            }
    15001500
     
    15091509                    _e( 'Error requesting membership', 'buddypress' );
    15101510                } else {
    1511                     echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
     1511                    echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button leave-group" rel="leave" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    15121512                }
    15131513
     
    15191519                    _e( 'Error requesting membership', 'buddypress' );
    15201520                } else {
    1521                     echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button disabled pending membership-requested" rel="membership-requested" title="' . __( 'Request Sent', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
     1521                    echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button disabled pending membership-requested" rel="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
    15221522                }
    15231523            }
     
    15301530            _e( 'Error leaving group', 'buddypress' );
    15311531        } elseif ( 'public' == $group->status ) {
    1532             echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
     1532            echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button join-group" rel="join" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
    15331533        } elseif ( 'private' == $group->status ) {
    1534             echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
     1534            echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button request-membership" rel="join" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
    15351535        }
    15361536    }
  • trunk/src/bp-templates/bp-legacy/buddypress/forums/forums-loop.php

    r11591 r11606  
    7272            <tr class="<?php bp_the_topic_css_class(); ?>">
    7373                <td class="td-title">
    74                     <a class="topic-title" href="<?php bp_the_topic_permalink(); ?>" title="<?php esc_attr_e( 'Permanent link to this post', 'buddypress' ); ?>">
     74                    <a class="topic-title" href="<?php bp_the_topic_permalink(); ?>">
    7575
    7676                        <?php bp_the_topic_title(); ?>
     
    8787                                <?php
    8888                                    $topic_in = '<a href="' . bp_get_the_topic_object_permalink() . '">' . bp_get_the_topic_object_avatar( 'type=thumb&width=20&height=20' ) . '</a>' .
    89                                                     '<a href="' . bp_get_the_topic_object_permalink() . '" title="' . bp_get_the_topic_object_name() . '">' . bp_get_the_topic_object_name() .'</a>';
     89                                                    '<a href="' . bp_get_the_topic_object_permalink() . '">' . bp_get_the_topic_object_name() .'</a>';
    9090
    9191                                    /* translators: "started by [poster] in [forum]" */
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/admin/manage-members.php

    r11591 r11606  
    268268                            <?php if ( bp_get_group_member_is_banned() ) : ?>
    269269
    270                                 <a href="<?php bp_group_member_unban_link(); ?>" class="button confirm member-unban" title="<?php esc_attr_e( 'Unban this member', 'buddypress' ); ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a>
     270                                <a href="<?php bp_group_member_unban_link(); ?>" class="button confirm member-unban"><?php _e( 'Remove Ban', 'buddypress' ); ?></a>
    271271
    272272                            <?php else : ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php

    r11171 r11606  
    2020        <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    2121            <div id="item-header-avatar">
    22                 <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>" title="<?php echo esc_attr( bp_get_group_name() ); ?>">
     22                <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>">
    2323
    2424                    <?php bp_group_avatar(); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php

    r11591 r11606  
    127127                        do_action( 'bp_group_forum_post_meta' ); ?>
    128128
    129                         <a href="#post-<?php bp_the_topic_post_id(); ?>" title="<?php esc_attr_e( 'Permanent link to this post', 'buddypress' ); ?>">#</a>
     129                        <a href="#post-<?php bp_the_topic_post_id(); ?>" aria-label="<?php esc_attr_e( 'Permanent link to this post', 'buddypress' ); ?>">#</a>
    130130                    </div>
    131131                </li>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/message.php

    r10181 r11606  
    3131                    <?php if ( bp_get_the_thread_message_sender_link() ) : ?>
    3232
    33                         <strong><a href="<?php bp_the_thread_message_sender_link(); ?>" title="<?php bp_the_thread_message_sender_name(); ?>"><?php bp_the_thread_message_sender_name(); ?></a></strong>
     33                        <strong><a href="<?php bp_the_thread_message_sender_link(); ?>"><?php bp_the_thread_message_sender_name(); ?></a></strong>
    3434
    3535                    <?php else : ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php

    r11591 r11606  
    7575                <td width="10%">
    7676                    <a class="button" href="<?php bp_message_activate_deactivate_link(); ?>" class="confirm"><?php bp_message_activate_deactivate_text(); ?></a>
    77                     <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php esc_attr_e( "Delete Message", 'buddypress' ); ?>">x</a>
     77                    <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" aria-label="<?php esc_attr_e( "Delete Message", 'buddypress' ); ?>">x</a>
    7878                </td>
    7979            </tr>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php

    r11576 r11606  
    4242            </span>
    4343
    44             <a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Conversation", 'buddypress' ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
     44            <a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
    4545
    4646            <?php
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/general.php

    r11591 r11606  
    2020
    2121        <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label>
    22         <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" <?php bp_form_field_attributes( 'password' ); ?>/> &nbsp;<a href="<?php echo wp_lostpassword_url(); ?>" title="<?php esc_attr_e( 'Password Lost and Found', 'buddypress' ); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a>
     22        <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" <?php bp_form_field_attributes( 'password' ); ?>/> &nbsp;<a href="<?php echo wp_lostpassword_url(); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a>
    2323
    2424    <?php endif; ?>
  • trunk/src/bp-templates/bp-legacy/js/buddypress.js

    r11601 r11606  
    19751975
    19761976                if ( !i ) {
    1977                     jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' );
     1977                    jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/">' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + '</a></li>' );
    19781978                }
    19791979            }
Note: See TracChangeset for help on using the changeset viewer.