From edfcc334713d684ecdb540ffc2e442c398b40042 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 14 Jan 2022 17:36:20 +0100 Subject: [PATCH] MDL-73584 lib: Remove role menubar from Actions menu The menubar role defined in the "menubar d-flex" element is not required and it's causing the following error "Required ARIA children role not present: group, menuitemradio, menuitem, menuitemcheckbox". --- course/classes/management_renderer.php | 4 ++++ lib/outputcomponents.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/course/classes/management_renderer.php b/course/classes/management_renderer.php index 3de3c7a5bbf..08373bc9220 100644 --- a/course/classes/management_renderer.php +++ b/course/classes/management_renderer.php @@ -378,6 +378,10 @@ class core_course_management_renderer extends plugin_renderer_base { if (!$hasitems) { return ''; } + + // If the action menu has items, add the menubar role to the main element containing it. + $menu->attributes['role'] = 'menubar'; + return $this->render($menu); } diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 1c962d78a3b..cea427f26cd 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -4237,7 +4237,6 @@ class action_menu implements renderable, templatable { $this->attributesprimary = array( 'id' => 'action-menu-'.$this->instance.'-menubar', 'class' => 'menubar', - 'role' => 'menubar' ); $this->attributessecondary = array( 'id' => 'action-menu-'.$this->instance.'-menu',