MDL-86488 output: Make the icon in action menu triggers decorative

* Set the action label properly.
* Set the kebab icon as a decorative icon.
* Move the title attribute to the menu button itself instead of the
kebab icon.
This commit is contained in:
Jun Pataleta
2025-09-17 15:16:34 +08:00
parent 93aa033801
commit e8dd16f7fd
3 changed files with 5 additions and 7 deletions
+2 -1
View File
@@ -218,7 +218,8 @@ class action_menu implements renderable, templatable {
}
$label = $triggername ?? get_string('actions');
$triggerclasses = self::DEFAULT_KEBAB_TRIGGER_CLASSES . ' ' . $extraclasses;
$icon = $output->pix_icon('i/menu', $label);
$icon = $output->pix_icon('i/menu', '') . html_writer::span($label, 'visually-hidden');
$this->triggerattributes += ['title' => $label];
$this->set_menu_trigger($icon, $triggerclasses);
}
+2 -2
View File
@@ -88,7 +88,7 @@
tabindex="0"
class="{{triggerextraclasses}} dropdown-toggle icon-no-margin"
id="action-menu-toggle-{{instance}}"
aria-label="{{title}}"
{{#title}}aria-label="{{title}}"{{/title}}
data-bs-toggle="dropdown"
role="{{triggerrole}}"
aria-haspopup="true"
@@ -102,7 +102,7 @@
{{{menutrigger}}}
{{#icon}}
{{#pix}}
{{key}},{{component}},{{title}}
{{key}},{{component}}
{{/pix}}
{{/icon}}
{{#rawicon}}{{{.}}}{{/rawicon}}
@@ -259,10 +259,7 @@ class system_report_table extends base_report_table {
global $OUTPUT;
$menu = new action_menu();
$menu->set_menu_trigger(
$OUTPUT->pix_icon('i/menu', get_string('actions', 'core_reportbuilder')),
'btn btn-icon d-flex no-caret',
);
$menu->set_kebab_trigger(get_string('actions', 'core_reportbuilder'));
$actions = array_filter($this->report->get_actions(), function($action) use ($row) {
// Only return dividers and action items who can be displayed for current users.