From 8cdd6191c133bea22d97131b6f04f9435343c69b Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Fri, 25 May 2018 16:57:47 +0530 Subject: [PATCH] dev/accessiblity#3 Add aria-label (and label?) to form elements missing them --- CRM/Contribute/Form/Contribution/Main.php | 4 ++-- CRM/Pledge/BAO/PledgeBlock.php | 6 +++--- templates/CRM/Core/BillingBlock.tpl | 3 ++- templates/CRM/Price/Form/Calculate.tpl | 12 +++++------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 9d7ed7c59b..5555cd93dd 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -554,7 +554,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 { @@ -595,7 +595,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 diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 4762ce1839..496ddf674d 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -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('
') ); - $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)) { diff --git a/templates/CRM/Core/BillingBlock.tpl b/templates/CRM/Core/BillingBlock.tpl index 1e7c56782e..73050a5e37 100644 --- a/templates/CRM/Core/BillingBlock.tpl +++ b/templates/CRM/Core/BillingBlock.tpl @@ -39,7 +39,8 @@
{$form.$paymentField.label} {if $requiredPaymentFields.$name}*{/if}
-
{$form.$paymentField.html} +
+ {$form.$paymentField.html} {if $paymentField == 'cvv2'}{* @todo move to form assignment*} {/if} diff --git a/templates/CRM/Price/Form/Calculate.tpl b/templates/CRM/Price/Form/Calculate.tpl index 7c0533f4cb..0d78268f9d 100644 --- a/templates/CRM/Price/Form/Calculate.tpl +++ b/templates/CRM/Price/Form/Calculate.tpl @@ -27,13 +27,11 @@ {assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay}
- +{if $hideTotal}, hiddenElement{/if}" id="pricelabel"> + {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )} + {ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts} + {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if} + {/if}
-- 2.25.1