mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
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:
parent
8e31a72c05
commit
178c51786c
1 changed files with 18 additions and 11 deletions
|
@ -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]),
|
||||
$linkattributes = [
|
||||
'title' => get_string('show') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'false',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'show',
|
||||
'data-column' => $column);
|
||||
'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]),
|
||||
$linkattributes = [
|
||||
'title' => get_string('hide') . ' ' . strip_tags($this->headers[$index]),
|
||||
'aria-expanded' => 'true',
|
||||
'aria-controls' => $ariacontrols,
|
||||
'data-action' => 'hide',
|
||||
'data-column' => $column);
|
||||
'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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue