Moved accessibility labels for checkout after woocommerce_checkout_fields filter
This commit is contained in:
parent
14ed29b6f3
commit
66540f1b5d
|
@ -267,6 +267,14 @@ class WC_Checkout {
|
|||
foreach ( $this->fields as $field_type => $fields ) {
|
||||
// Sort each of the checkout field sections based on priority.
|
||||
uasort( $this->fields[ $field_type ], 'wc_checkout_fields_uasort_comparison' );
|
||||
|
||||
//add accessibility labels to fields that have placeholders
|
||||
foreach ( $fields as $single_field_type => $field) {
|
||||
if ( empty( $field[ 'label' ] ) && !empty( $field[ 'placeholder' ] )) {
|
||||
$this->fields[ $field_type ][ $single_field_type ][ 'label' ] = $field[ 'placeholder' ];
|
||||
$this->fields[ $field_type ][ $single_field_type ][ 'label_class' ] = 'screen-reader-text';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fieldset ? $this->fields[ $fieldset ] : $this->fields;
|
||||
|
|
|
@ -664,8 +664,6 @@ class WC_Countries {
|
|||
'priority' => 50,
|
||||
),
|
||||
'address_2' => array(
|
||||
'label' => __( 'Apartment, suite, unit etc.', 'woocommerce' ),
|
||||
'label_class' => array( 'screen-reader-text' ),
|
||||
'placeholder' => esc_attr( $address_2_placeholder ),
|
||||
'class' => array( 'form-row-wide', 'address-field' ),
|
||||
'autocomplete' => 'address-line2',
|
||||
|
|
Loading…
Reference in New Issue