Merge pull request #12207 from JMAConsulting/access-3-contri
authorcolemanw <coleman@civicrm.org>
Fri, 20 Jul 2018 16:10:48 +0000 (12:10 -0400)
committerGitHub <noreply@github.com>
Fri, 20 Jul 2018 16:10:48 +0000 (12:10 -0400)
dev/accessiblity#3 Add aria-label to form elements of contribution page which don't have accessible labels

CRM/Contribute/Form/Contribution/Main.php
CRM/Pledge/BAO/PledgeBlock.php
templates/CRM/Core/BillingBlock.tpl
templates/CRM/Price/Form/Calculate.tpl

index 109189f9c010ad569530717ca9c934c89d3ddfb4..4a302b82b70a19e761745512bccbaa737e23d24a 100644 (file)
@@ -563,7 +563,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $form->add('checkbox', 'is_recur', ts('I want to contribute this amount'), NULL);
 
     if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
-      $form->add('text', 'frequency_interval', ts('Every'), $attributes['frequency_interval']);
+      $form->add('text', 'frequency_interval', ts('Every'), $attributes['frequency_interval'] + ['aria-label' => ts('Every')]);
       $form->addRule('frequency_interval', ts('Frequency must be a whole number (EXAMPLE: Every 3 months).'), 'integer');
     }
     else {
@@ -604,7 +604,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           }
         }
       }
-      $frequencyUnit = &$form->add('select', 'frequency_unit', NULL, $units);
+      $frequencyUnit = &$form->addElement('select', 'frequency_unit', NULL, $units, ['aria-label' => ts('Frequency Unit')]);
     }
 
     // FIXME: Ideally we should freeze select box if there is only
index 4762ce1839c7b30afcb4853f3b950b846a16271a..496ddf674dfff641ff01f64a49741df32ce12043 100644 (file)
@@ -281,11 +281,11 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
       $form->addRadio('is_pledge', ts('Pledge Frequency Interval'), $pledgeOptions,
         NULL, array('<br/>')
       );
-      $form->addElement('text', 'pledge_installments', ts('Installments'), array('size' => 3));
+      $form->addElement('text', 'pledge_installments', ts('Installments'), ['size' => 3, 'aria-label' => ts('Installments')]);
 
       if (!empty($pledgeBlock['is_pledge_interval'])) {
         $form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock));
-        $form->addElement('text', 'pledge_frequency_interval', NULL, array('size' => 3));
+        $form->addElement('text', 'pledge_frequency_interval', NULL, ['size' => 3, 'aria-label' => ts('Frequency Intervals')]);
       }
       else {
         $form->add('hidden', 'pledge_frequency_interval', 1);
@@ -299,7 +299,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
           $freqUnits[$val] = !empty($pledgeBlock['is_pledge_interval']) ? "{$frequencyUnits[$val]}(s)" : $frequencyUnits[$val];
         }
       }
-      $form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits);
+      $form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits, ['aria-label' => ts('Frequency Units')]);
       // CRM-18854
       if (CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)) {
         if (CRM_Utils_Array::value('pledge_start_date', $pledgeBlock)) {
index 1e7c56782e610ca2ec7c3ef1a05423df54cdc83d..73050a5e3737112ebe54716f6cf72fe820abe03b 100644 (file)
@@ -39,7 +39,8 @@
             <div class="label">{$form.$paymentField.label}
               {if $requiredPaymentFields.$name}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>{/if}
             </div>
-            <div class="content">{$form.$paymentField.html}
+            <div class="content">
+                {$form.$paymentField.html}
               {if $paymentField == 'cvv2'}{* @todo move to form assignment*}
                 <span class="cvv2-icon" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
               {/if}
index 7c0533f4cb0441ddcd7cbdabc7bba57cffe3043e..0d78268f9d302a7bee703d44463e7578a7aaaec2 100644 (file)
 {assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay}
 <div id="pricesetTotal" class="crm-section section-pricesetTotal">
   <div class="label
-  {if $hideTotal},  hiddenElement{/if}" id="pricelabel">
-    <label>
-      {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
-      <span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span>
-       {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
-      {/if}
-    </label>
+{if $hideTotal},  hiddenElement{/if}" id="pricelabel">
+    {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
+    <span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span>
+     {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
+    {/if}
   </div>
   <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div>
 </div>