Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/20/2018 12:34:32 PM (8 years ago)
Author:
djpaul
Message:

Templates, xprofile: fix markup a11y for date field type labels.

Correcting use of existing label elements -- and making them visible -- makes it obvious what the three date field elements represent (day, month, year) for all users.

Fixes #7665

Props Venutius, mercime, rianrietveld, hnla, djpaul.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

    r11749 r11905  
    106106                                do_action( bp_get_the_profile_field_errors_action() ); ?>
    107107
    108                                 <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    109                                         /* translators: accessibility text */
    110                                         esc_html_e( 'Select day', 'buddypress' );
     108                                <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="xprofile-field-label"><?php
     109                                        esc_html_e( 'Day', 'buddypress' );
    111110                                ?></label>
    112111                                <select <?php echo $this->get_edit_field_html_elements( $day_r ); ?>>
     
    117116                                </select>
    118117
    119                                 <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    120                                         /* translators: accessibility text */
    121                                         esc_html_e( 'Select month', 'buddypress' );
     118                                <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="xprofile-field-label"><?php
     119                                        esc_html_e( 'Month', 'buddypress' );
    122120                                ?></label>
    123121                                <select <?php echo $this->get_edit_field_html_elements( $month_r ); ?>>
     
    128126                                </select>
    129127
    130                                 <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
    131                                         /* translators: accessibility text */
    132                                         esc_html_e( 'Select year', 'buddypress' );
     128                                <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="xprofile-field-label"><?php
     129                                        esc_html_e( 'Year', 'buddypress' );
    133130                                ?></label>
    134131                                <select <?php echo $this->get_edit_field_html_elements( $year_r ); ?>>
     
    301298                ) ); ?>
    302299
    303                 <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="screen-reader-text"><?php
    304                         /* translators: accessibility text */
    305                         esc_html_e( 'Select day', 'buddypress' );
     300                <label for="<?php bp_the_profile_field_input_name(); ?>_day" class="xprofile-field-label"><?php
     301                        esc_html_e( 'Day', 'buddypress' );
    306302                ?></label>
    307303                <select <?php echo $this->get_edit_field_html_elements( $day_r ); ?>>
     
    309305                </select>
    310306
    311                 <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="screen-reader-text"><?php
    312                         /* translators: accessibility text */
    313                         esc_html_e( 'Select month', 'buddypress' );
     307                <label for="<?php bp_the_profile_field_input_name(); ?>_month" class="xprofile-field-label"><?php
     308                        esc_html_e( 'Month', 'buddypress' );
    314309                ?></label>
    315310                <select <?php echo $this->get_edit_field_html_elements( $month_r ); ?>>
     
    317312                </select>
    318313
    319                 <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="screen-reader-text"><?php
    320                         /* translators: accessibility text */
    321                         esc_html_e( 'Select year', 'buddypress' );
     314                <label for="<?php bp_the_profile_field_input_name(); ?>_year" class="xprofile-field-label"><?php
     315                        esc_html_e( 'Year', 'buddypress' );
    322316                ?></label>
    323317                <select <?php echo $this->get_edit_field_html_elements( $year_r ); ?>>
Note: See TracChangeset for help on using the changeset viewer.