Skip to content

Commit c9186c9

Browse files
authored
Merge pull request #30694 from JMAConsulting/a11y_fixes_report_2
[REF] Fix empty label accessibility issue on report elements
2 parents 780fa04 + e032685 commit c9186c9

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CRM/Report/Form.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ public function addFilters() {
14781478
default:
14791479
// default type is string
14801480
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations,
1481-
['onchange' => "return showHideMaxMinVal( '$fieldName', this.value );"]
1481+
['onchange' => "return showHideMaxMinVal( '$fieldName', this.value );", 'title' => ts('%1 Filter Operator', [1 => $field['title']])]
14821482
);
14831483
// we need text box for value input
14841484
$this->add('text', "{$fieldName}_value", NULL, ['class' => 'huge']);
@@ -1695,8 +1695,8 @@ public function addOrderBys() {
16951695
'ASC' => ts('Ascending'),
16961696
'DESC' => ts('Descending'),
16971697
]);
1698-
$this->addElement('checkbox', "order_bys[{$i}][section]", ts('Order by Section'), FALSE, ['id' => "order_by_section_$i"]);
1699-
$this->addElement('checkbox', "order_bys[{$i}][pageBreak]", ts('Page Break'), FALSE, ['id' => "order_by_pagebreak_$i"]);
1698+
$this->addElement('checkbox', "order_bys[{$i}][section]", ts('Order by Section'), FALSE, ['id' => "order_by_section_$i", 'title' => ts('Order by Section %1', [1 => $i])]);
1699+
$this->addElement('checkbox', "order_bys[{$i}][pageBreak]", ts('Page Break'), FALSE, ['id' => "order_by_pagebreak_$i", 'title' => ts('Page Break %1', [1 => $i])]);
17001700
}
17011701
}
17021702
}
@@ -1723,7 +1723,7 @@ public function buildInstanceAndButtons() {
17231723
$this->addElement('select', 'groups', ts('Group'),
17241724
['' => ts('Add Contacts to Group')] +
17251725
CRM_Core_PseudoConstant::nestedGroup(),
1726-
['class' => 'crm-select2 crm-action-menu fa-plus huge']
1726+
['class' => 'crm-select2 crm-action-menu fa-plus huge', 'title' => ts('Add Contacts to Group')]
17271727
);
17281728
$this->assign('group', TRUE);
17291729
}

CRM/Report/Form/Instance.php

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public static function buildForm(&$form) {
125125
'size' => 5,
126126
'style' => 'width:240px',
127127
'class' => 'advmultiselect',
128+
'title' => ts('ACL Group/Role'),
128129
]
129130
);
130131
$grouprole->setButtonAttributes('add', ['value' => ts('Add >>')]);

templates/CRM/Report/Form/Tabs/Filters.tpl

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@
3737
<td class="label report-contents">{if !empty($field.title)}{$field.title}{/if}</td>
3838
<td class="report-contents">{$form.$fieldOp.html}</td>
3939
<td>
40-
<span id="{$filterVal}_cell">{$form.$filterVal.label}&nbsp;{$form.$filterVal.html}</span>
40+
<span id="{$filterVal}_cell">
41+
<label class="sr-only" for="{$form.$filterVal.id}">
42+
{if !empty($field.title)}{$field.title}{else}{$field.name}{/if} filter value
43+
</label>
44+
{$form.$filterVal.label}&nbsp;{$form.$filterVal.html}
45+
</span>
4146
<span id="{$filterMin}_max_cell">
4247
{if array_key_exists($filterMin, $form) && $form.$filterMin}{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}&nbsp;&nbsp;{/if}
4348
{if array_key_exists($filterMax, $form) && $form.$filterMax}{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}{/if}

0 commit comments

Comments
 (0)