Skip to content

Commit

Permalink
Merge pull request #17675 from agh1/aria-form-fixes
Browse files Browse the repository at this point in the history
Select field fixes for screen reader
  • Loading branch information
colemanw authored Oct 4, 2020
2 parents 0a6868c + 5ad66c4 commit 2900b9c
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 173 deletions.
13 changes: 7 additions & 6 deletions CRM/ACL/Form/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ public function buildQuickForm() {

$this->add('text', 'name', ts('Description'), CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL', 'name'), TRUE);

$operations = ['' => ts('- select -')] + CRM_ACL_BAO_ACL::operation();
$this->add('select',
'operation',
ts('Operation'),
$operations, TRUE
CRM_ACL_BAO_ACL::operation(),
TRUE,
['placeholder' => TRUE]
);

$objTypes = [
Expand Down Expand Up @@ -129,22 +130,22 @@ public function buildQuickForm() {
$this->add('select', 'entity_id', $label, $role, TRUE);

$group = [
'-1' => ts('- select -'),
'-1' => ts('- select group -'),
'0' => ts('All Groups'),
] + CRM_Core_PseudoConstant::group();

$customGroup = [
'-1' => ts('- select -'),
'-1' => ts('- select set of custom fields -'),
'0' => ts('All Custom Groups'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');

$ufGroup = [
'-1' => ts('- select -'),
'-1' => ts('- select profile -'),
'0' => ts('All Profiles'),
] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');

$event = [
'-1' => ts('- select -'),
'-1' => ts('- select event -'),
'0' => ts('All Events'),
] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");

Expand Down
3 changes: 1 addition & 2 deletions CRM/ACL/Form/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ public function buildQuickForm() {
return;
}

$aclRoles = ['' => ts('- select -')] + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'acl_role_id', ts('ACL Role'),
$aclRoles, TRUE
CRM_Core_OptionGroup::values('acl_role'), TRUE, ['placeholder' => TRUE]
);

$label = ts('Assigned to');
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public static function buildSearchForm(&$form) {
'multiple' =>
'multiple',
'class' => 'crm-select2',
'placeholder' => ts('- select -'),
'placeholder' => ts('- select tags -'),
]
);
}
Expand Down
6 changes: 4 additions & 2 deletions CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,11 @@ public function buildQuickForm() {
$this->assign('suppressForm', FALSE);

$element = $this->add('select', 'activity_type_id', ts('Activity Type'),
['' => '- ' . ts('select') . ' -'] + $this->_fields['followup_activity_type_id']['attributes'],
$this->_fields['followup_activity_type_id']['attributes'],
FALSE, [
'onchange' => "CRM.buildCustomData( 'Activity', this.value, false, false, false, false, false, false, {$this->_currentlyViewedContactId});",
'class' => 'crm-select2 required',
'placeholder' => TRUE,
]
);

Expand Down Expand Up @@ -695,7 +696,8 @@ public function buildQuickForm() {
$responseOptions = CRM_Campaign_BAO_Survey::getResponsesOptions($surveyId);
if ($responseOptions) {
$this->add('select', 'result', ts('Result'),
['' => ts('- select -')] + array_combine($responseOptions, $responseOptions)
array_combine($responseOptions, $responseOptions),
FALSE, ['placeholder' => TRUE]
);
}
$surveyTitle = NULL;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function buildQuickForm($check = FALSE) {
$this->add('datepicker', 'scheduled_run_date', ts('Scheduled Run Date'), NULL, FALSE, ['minDate' => date('Y-m-d')]);

$this->add('textarea', 'parameters', ts('Command parameters'),
"cols=50 rows=6"
['cols' => 50, 'rows' => 6]
);

// is this job active ?
Expand Down
4 changes: 2 additions & 2 deletions CRM/Admin/Form/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function buildQuickForm() {
)
) {
$this->add('textarea', 'msg_html', ts('HTML Message'),
"cols=50 rows=6"
['cols' => 50, 'rows' => 6]
);
}
else {
Expand All @@ -194,7 +194,7 @@ public function buildQuickForm() {
}

$this->add('textarea', 'msg_text', ts('Text Message'),
"cols=50 rows=6"
['cols' => 50, 'rows' => 6]
);

$this->add('select', 'pdf_format_id', ts('PDF Page Format'),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/PdfFormats.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function buildQuickForm() {
['onChange' => "selectPaper( this.value );"]
);

$this->add('static', 'paper_dimensions', NULL, ts('Width x Height'));
$this->add('static', 'paper_dimensions', ts('Width x Height'));
$this->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_PdfFormat::getPageOrientations(), FALSE,
['onChange' => "updatePaperDimensions();"]
);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/EmailTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function buildQuickForm() {

$this->assign('totalSelectedContacts', count($this->_contactIds));

$this->add('text', 'subject', ts('Subject'), 'size=50 maxlength=254', TRUE);
$this->add('text', 'subject', ts('Subject'), ['size' => 50, 'maxlength' => 254], TRUE);

$this->add('select', 'from_email_address', ts('From'), $this->_fromEmails, TRUE);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/ContributionPage/Premium.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function buildQuickForm() {

$this->addElement('text', 'premiums_intro_title', ts('Title'), $attributes['premiums_intro_title']);

$this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), 'rows=5, cols=50');
$this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), ['cols' => 50, 'rows' => 5]);

$this->add('text', 'premiums_contact_email', ts('Contact Email') . ' ', $attributes['premiums_contact_email']);

Expand Down
17 changes: 9 additions & 8 deletions CRM/Contribute/Form/ManagePremiums.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function buildQuickForm() {
]);
$this->add('text', 'sku', ts('SKU'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'sku'));

$this->add('textarea', 'description', ts('Description'), 'rows=3, cols=60');
$this->add('textarea', 'description', ts('Description'), ['cols' => 60, 'rows' => 3]);

$image['image'] = $this->createElement('radio', NULL, NULL, ts('Upload from my computer'), 'image', 'onclick="add_upload_file_block(\'image\');');
$image['thumbnail'] = $this->createElement('radio', NULL, NULL, ts('Display image and thumbnail from these locations on the web:'), 'thumbnail', 'onclick="add_upload_file_block(\'thumbnail\');');
Expand All @@ -94,7 +94,7 @@ public function buildQuickForm() {
$this->addElement('text', 'imageUrl', ts('Image URL'));
$this->addElement('text', 'thumbnailUrl', ts('Thumbnail URL'));

$this->add('file', 'uploadFile', ts('Image File Name'), 'onChange="select_option();"');
$this->add('file', 'uploadFile', ts('Image File Name'), ['onChange' => 'select_option();']);

$this->add('text', 'price', ts('Market Value'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'price'), TRUE);
$this->addRule('price', ts('Please enter the Market Value for this product.'), 'money');
Expand All @@ -105,21 +105,20 @@ public function buildQuickForm() {
$this->add('text', 'min_contribution', ts('Minimum Contribution Amount'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'min_contribution'), TRUE);
$this->addRule('min_contribution', ts('Please enter a monetary value for the Minimum Contribution Amount.'), 'money');

$this->add('textarea', 'options', ts('Options'), 'rows=3, cols=60');
$this->add('textarea', 'options', ts('Options'), ['cols' => 60, 'rows' => 3]);

$this->add('select', 'period_type', ts('Period Type'), [
'' => '- select -',
'rolling' => 'Rolling',
'fixed' => 'Fixed',
]);
], FALSE, ['placeholder' => TRUE]);

$this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day'));

$this->add('Select', 'duration_unit', ts('Duration Unit'), ['' => '- select period -'] + CRM_Core_SelectValues::getPremiumUnits());
$this->add('Select', 'duration_unit', ts('Duration Unit'), CRM_Core_SelectValues::getPremiumUnits(), FALSE, ['placeholder' => ts('- select period -')]);

$this->add('text', 'duration_interval', ts('Duration'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'duration_interval'));

$this->add('Select', 'frequency_unit', ts('Frequency Unit'), ['' => '- select period -'] + CRM_Core_SelectValues::getPremiumUnits());
$this->add('Select', 'frequency_unit', ts('Frequency Unit'), CRM_Core_SelectValues::getPremiumUnits(), FALSE, ['placeholder' => ts('- select period -')]);

$this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval'));

Expand Down Expand Up @@ -157,7 +156,9 @@ public function buildQuickForm() {
'select',
'financial_type_id',
ts('Financial Type'),
['' => ts('- select -')] + $financialType
$financialType,
FALSE,
['placeholder' => TRUE]
);

$this->add('checkbox', 'is_active', ts('Enabled?'));
Expand Down
Loading

0 comments on commit 2900b9c

Please sign in to comment.