MDL-68550 tablelib: Use aria-role=button
Use the aria-role=button for: - show/hide links - sort links - reset table preferences link
This commit is contained in:
+18
-11
@@ -1232,20 +1232,26 @@ class flexible_table {
|
||||
$ariacontrols = trim($ariacontrols);
|
||||
|
||||
if (!empty($this->prefs['collapse'][$column])) {
|
||||
$linkattributes = array('title' => get_string('show') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'false',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'show',
|
||||
'data-column' => $column);
|
||||
$linkattributes = [
|
||||
'title' => get_string('show') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'false',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'show',
|
||||
'data-column' => $column,
|
||||
'role' => 'button',
|
||||
];
|
||||
return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_SHOW] => $column)),
|
||||
$OUTPUT->pix_icon('t/switch_plus', null), $linkattributes);
|
||||
|
||||
} else if ($this->headers[$index] !== NULL) {
|
||||
$linkattributes = array('title' => get_string('hide') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'true',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'hide',
|
||||
'data-column' => $column);
|
||||
$linkattributes = [
|
||||
'title' => get_string('hide') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'true',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'hide',
|
||||
'data-column' => $column,
|
||||
'role' => 'button',
|
||||
];
|
||||
return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_HIDE] => $column)),
|
||||
$OUTPUT->pix_icon('t/switch_minus', null), $linkattributes);
|
||||
}
|
||||
@@ -1664,6 +1670,7 @@ class flexible_table {
|
||||
'data-sortable' => $this->is_sortable($column),
|
||||
'data-sortby' => $column,
|
||||
'data-sortorder' => $sortorder,
|
||||
'role' => 'button',
|
||||
]) . ' ' . $this->sort_icon($isprimary, $order);
|
||||
}
|
||||
|
||||
@@ -1861,7 +1868,7 @@ class flexible_table {
|
||||
$url = $this->baseurl->out(false, array($this->request[TABLE_VAR_RESET] => 1));
|
||||
|
||||
$html = html_writer::start_div('resettable mdl-right');
|
||||
$html .= html_writer::link($url, get_string('resettable'));
|
||||
$html .= html_writer::link($url, get_string('resettable'), ['role' => 'button']);
|
||||
$html .= html_writer::end_div();
|
||||
|
||||
return $html;
|
||||
|
||||
Reference in New Issue
Block a user