Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Added labels on attendee fields form to improve accessibility #a11y #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/field-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function question_field_country( $name, $user_value, $question ) {
$countries = array( 'Abkhazia', 'Afghanistan', 'Aland', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Ascension', 'Ashmore and Cartier Islands', 'Australia', 'Australian Antarctic Territory', 'Austria', 'Azerbaijan', 'Bahamas, The', 'Bahrain', 'Baker Island', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Antarctic Territory', 'British Indian Ocean Territory', 'British Sovereign Base Areas', 'British Virgin Islands', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', "China, People's Republic of", 'China, Republic of (Taiwan)', 'Christmas Island', 'Clipperton Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo, (Congo – Brazzaville)', 'Congo, (Congo – Kinshasa)', 'Cook Islands', 'Coral Sea Islands', 'Costa Rica', "Cote d'Ivoire (Ivory Coast)", 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islands (Islas Malvinas)', 'Faroe Islands', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern and Antarctic Lands', 'Gabon', 'Gambia, The', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Heard Island and McDonald Islands', 'Honduras', 'Hong Kong', 'Howland Island', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jarvis Island', 'Jersey', 'Johnston Atoll', 'Jordan', 'Kazakhstan', 'Kenya', 'Kingman Reef', 'Kiribati', 'Korea, North', 'Korea, South', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macau', 'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Midway Islands', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar (Burma)', 'Nagorno-Karabakh', 'Namibia', 'Nauru', 'Navassa Island', 'Nepal', 'Netherlands', 'Netherlands Antilles', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Cyprus', 'Northern Mariana Islands', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palmyra Atoll', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Peter I Island', 'Philippines', 'Pitcairn Islands', 'Poland', 'Portugal', 'Pridnestrovie (Transnistria)', 'Puerto Rico', 'Qatar', 'Queen Maud Land', 'Reunion', 'Romania', 'Ross Dependency', 'Russia', 'Rwanda', 'Saint Barthelemy', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'Somaliland', 'South Africa', 'South Georgia & South Sandwich Islands', 'South Ossetia', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste (East Timor)', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tristan da Cunha', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu', 'U.S. Virgin Islands', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 'Venezuela', 'Vietnam', 'Wake Island', 'Wallis and Futuna', 'Yemen', 'Zambia', 'Zimbabwe' );
?>

<select name="<?php echo esc_attr( $name ); ?>">
<select name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>">
<?php foreach ( $countries as $country ) : ?>
<option value="<?php echo esc_attr( $country ); ?>" <?php selected( $country, $user_value ); ?>>
<?php echo esc_html( $country ); ?>
Expand Down
2 changes: 1 addition & 1 deletion addons/field-tshirt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function question_field_types( $types ) {
function question_field_tshirt( $name, $value, $question ) {
$values = get_post_meta( $question->ID, 'tix_values', true );
?>
<select name="<?php echo esc_attr( $name ); ?>" />
<select name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>" />
<?php foreach ( (array) $values as $question_value ) : ?>
<option <?php selected( $question_value, $value ); ?> value="<?php echo esc_attr( $question_value ); ?>"><?php echo esc_html( $question_value ); ?></option>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion addons/field-url.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function question_field_types( $types ) {
*/
function question_field_url( $name, $value ) {
?>
<input name="<?php echo esc_attr( $name ); ?>" type="url" value="<?php echo esc_attr( $value ); ?>" />
<input name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>" type="url" value="<?php echo esc_attr( $value ); ?>" />
<?php
}

Expand Down
22 changes: 11 additions & 11 deletions camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,7 @@ function question_fields_init() {
*/
function question_field_text( $name, $value ) {
?>
<input name="<?php echo esc_attr( $name ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
<input name="<?php echo esc_attr( $name ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" id="<?php echo esc_attr( $name ); ?>" />
<?php
}

Expand All @@ -4156,7 +4156,7 @@ function question_field_text( $name, $value ) {
function question_field_select( $name, $user_value, $question ) {
$values = get_post_meta( $question->ID, 'tix_values', true );
?>
<select name="<?php echo esc_attr( $name ); ?>" />
<select name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>" />
<?php foreach ( (array) $values as $question_value ) : ?>
<option <?php selected( $question_value, $user_value ); ?> value="<?php echo esc_attr( $question_value ); ?>"><?php echo esc_html( $question_value ); ?></option>
<?php endforeach; ?>
Expand Down Expand Up @@ -4194,7 +4194,7 @@ function question_field_checkbox( $name, $user_value, $question ) {
*/
function question_field_textarea( $name, $value ) {
?>
<textarea name="<?php echo esc_attr( $name ); ?>"><?php echo esc_textarea( $value ); ?></textarea>
<textarea name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>"><?php echo esc_textarea( $value ); ?></textarea>
<?php
}

Expand Down Expand Up @@ -5458,17 +5458,17 @@ function form_attendee_info() {

<?php ob_start(); ?>
<tr class="tix-row-first-name">
<td class="tix-required tix-left"><?php _e( 'First Name', 'camptix' ); ?> <span class="tix-required-star">*</span></td>
<td class="tix-required tix-left"><label for="tix_attendee_info[<?php echo esc_attr( $i ); ?>][first_name]"><?php _e( 'First Name', 'camptix' ); ?> <span class="tix-required-star">*</span></label></td>
<?php $value = isset( $this->form_data['tix_attendee_info'][$i]['first_name'] ) ? $this->form_data['tix_attendee_info'][$i]['first_name'] : apply_filters( 'camptix_attendee_info_default_value', '', 'first_name', $this->form_data, $ticket, $i ); ?>
<td class="tix-right"><input name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][first_name]" type="text" value="<?php echo esc_attr( $value ); ?>" /></td>
<td class="tix-right"><input name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][first_name]" id="tix_attendee_info[<?php echo esc_attr( $i ); ?>][first_name]" type="text" value="<?php echo esc_attr( $value ); ?>" /></td>
</tr>
<?php $first = ob_get_clean(); ?>

<?php ob_start(); ?>
<tr class="tix-row-last-name">
<td class="tix-required tix-left"><?php _e( 'Last Name', 'camptix' ); ?> <span class="tix-required-star">*</span></td>
<td class="tix-required tix-left"><label for="tix_attendee_info[<?php echo esc_attr( $i ); ?>][last_name]"><?php _e( 'Last Name', 'camptix' ); ?> <span class="tix-required-star">*</span></label></td>
<?php $value = isset( $this->form_data['tix_attendee_info'][$i]['last_name'] ) ? $this->form_data['tix_attendee_info'][$i]['last_name'] : apply_filters( 'camptix_attendee_info_default_value', '', 'last_name', $this->form_data, $ticket, $i ); ?>
<td class="tix-right"><input name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][last_name]" type="text" value="<?php echo esc_attr( $value ); ?>" /></td>
<td class="tix-right"><input name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][last_name]" id="tix_attendee_info[<?php echo esc_attr( $i ); ?>][last_name]" type="text" value="<?php echo esc_attr( $value ); ?>" /></td>
</tr>
<?php $last = ob_get_clean(); ?>

Expand All @@ -5477,10 +5477,10 @@ function form_attendee_info() {
<?php do_action( 'camptix_attendee_form_additional_info', $this->form_data, $i, $this->tickets_selected_count ); ?>

<tr class="tix-row-email">
<td class="tix-required tix-left"><?php _e( 'E-mail', 'camptix' ); ?> <span class="tix-required-star">*</span></td>
<td class="tix-required tix-left"><label for="tix_attendee_info[<?php echo esc_attr( $i ); ?>][email]"><?php _e( 'E-mail', 'camptix' ); ?> <span class="tix-required-star">*</span></label></td>
<?php $value = isset( $this->form_data['tix_attendee_info'][$i]['email'] ) ? $this->form_data['tix_attendee_info'][$i]['email'] : apply_filters( 'camptix_attendee_info_default_value', '', 'email', $this->form_data, $ticket, $i ); ?>
<td class="tix-right">
<input class="tix-field-email" name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][email]" type="email" value="<?php echo esc_attr( $value ); ?>" />
<input class="tix-field-email" name="tix_attendee_info[<?php echo esc_attr( $i ); ?>][email]" id="tix_attendee_info[<?php echo esc_attr( $i ); ?>][email]" type="email" value="<?php echo esc_attr( $value ); ?>" />
<?php $tix_receipt_email = isset( $this->form_data['tix_receipt_email'] ) ? $this->form_data['tix_receipt_email'] : 1; ?>

<?php if ( $this->tickets_selected_count > 1 ) : ?>
Expand Down Expand Up @@ -5510,8 +5510,8 @@ function form_attendee_info() {

<tr class="<?php echo esc_attr( $class_name ); ?>">
<td class="<?php if ( $required ) echo 'tix-required'; ?> tix-left">
<?php echo esc_html( apply_filters( 'the_title', $question->post_title ) ); ?>
<?php if ( $required ) echo ' <span class="tix-required-star">*</span>'; ?>
<label for="<?php echo esc_attr( $name ); ?>"><?php echo esc_html( apply_filters( 'the_title', $question->post_title ) ); ?>
<?php if ( $required ) echo ' <span class="tix-required-star">*</span>'; ?></label>
</td>
<td class="tix-right">
<?php do_action( "camptix_question_field_{$type}", $name, $value, $question ); ?>
Expand Down