MDL-42796 ActionMenu: Add additional keyboard event handling

Add additional handling for up/down/escape key presses and consolidate them
with the existing tab/shift+tab handling.
This commit is contained in:
Andrew Nicols
2013-12-06 16:20:10 +08:00
parent a4e1fefa39
commit 11dd4dadb4
9 changed files with 751 additions and 114 deletions
+2 -6
View File
@@ -1099,24 +1099,20 @@ class core_renderer extends renderer_base {
foreach ($menu->get_primary_actions($this) as $action) {
if ($action instanceof renderable) {
$content = $this->render($action);
$role = 'presentation';
} else {
$content = $action;
$role = 'menuitem';
}
$output .= html_writer::tag('li', $content, array('role' => $role));
$output .= html_writer::tag('li', $content, array('role' => 'presentation'));
}
$output .= html_writer::end_tag('ul');
$output .= html_writer::start_tag('ul', $menu->attributessecondary);
foreach ($menu->get_secondary_actions() as $action) {
if ($action instanceof renderable) {
$content = $this->render($action);
$role = 'presentation';
} else {
$content = $action;
$role = 'menuitem';
}
$output .= html_writer::tag('li', $content, array('role' => $role));
$output .= html_writer::tag('li', $content, array('role' => 'presentation'));
}
$output .= html_writer::end_tag('ul');
$output .= html_writer::end_tag('div');