mirror of
https://github.com/moodle/moodle.git
synced 2025-06-05 07:35:09 +02:00
MDL-70792 output: Menu items should have -1 tab index
* As per WAI ARIA Authoring Practices 1.1 guidelines for menus, menu items should have a tab index of -1. Navigation between menu items is done via arrow keys. See https://www.w3.org/TR/wai-aria-practices-1.1/#menu
This commit is contained in:
parent
122b0fc91e
commit
13cdef5dc4
@ -4340,6 +4340,7 @@ class action_menu implements renderable, templatable {
|
||||
public function add_primary_action($action) {
|
||||
if ($action instanceof action_link || $action instanceof pix_icon) {
|
||||
$action->attributes['role'] = 'menuitem';
|
||||
$action->attributes['tabindex'] = '-1';
|
||||
if ($action instanceof action_menu_link) {
|
||||
$action->actionmenu = $this;
|
||||
}
|
||||
@ -4355,6 +4356,7 @@ class action_menu implements renderable, templatable {
|
||||
public function add_secondary_action($action) {
|
||||
if ($action instanceof action_link || $action instanceof pix_icon) {
|
||||
$action->attributes['role'] = 'menuitem';
|
||||
$action->attributes['tabindex'] = '-1';
|
||||
if ($action instanceof action_menu_link) {
|
||||
$action->actionmenu = $this;
|
||||
}
|
||||
@ -4412,7 +4414,8 @@ class action_menu implements renderable, templatable {
|
||||
'title' => $title,
|
||||
'aria-label' => $label,
|
||||
'id' => 'action-menu-toggle-'.$this->instance,
|
||||
'role' => 'menuitem'
|
||||
'role' => 'menuitem',
|
||||
'tabindex' => '-1',
|
||||
);
|
||||
$link = html_writer::link('#', $string . $this->menutrigger . $pixicon, $attributes);
|
||||
if ($this->prioritise) {
|
||||
|
@ -59,7 +59,7 @@
|
||||
}}
|
||||
{{#items}}
|
||||
{{#link}}
|
||||
<a href="{{{url}}}" class="dropdown-item" role="menuitem">
|
||||
<a href="{{{url}}}" class="dropdown-item" role="menuitem" tabindex="-1">
|
||||
{{#pixicon}}
|
||||
{{#pix}}{{pixicon}}{{/pix}}
|
||||
{{/pixicon}}
|
||||
@ -70,7 +70,7 @@
|
||||
</a>
|
||||
{{/link}}
|
||||
{{#submenulink}}
|
||||
<a href="#" class="carousel-navigation-link dropdown-item" role="menuitem" data-carousel-target-id="carousel-item-{{submenuid}}">
|
||||
<a href="#" class="carousel-navigation-link dropdown-item" role="menuitem" tabindex="-1" data-carousel-target-id="carousel-item-{{submenuid}}">
|
||||
{{#pixicon}}
|
||||
{{#pix}}{{pixicon}}{{/pix}}
|
||||
{{/pixicon}}
|
||||
|
@ -41,7 +41,7 @@
|
||||
}}
|
||||
{{#items}}
|
||||
{{#link}}
|
||||
<a href="{{{url}}}" class="dropdown-item pl-5" role="menuitem" {{#isactive}}aria-current="true"{{/isactive}}>
|
||||
<a href="{{{url}}}" class="dropdown-item pl-5" role="menuitem" tabindex="-1" {{#isactive}}aria-current="true"{{/isactive}}>
|
||||
{{text}}
|
||||
</a>
|
||||
{{/link}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user