Skip to content

Commit a9b20c8

Browse files
authored
[6.0] Refactor default frontend menu to fix submenu support and improve accessiblity (joomla#45922)
* [6.0] Fix and refactor frontend menu - improve accessibility with aria attributes for submenus - add keyboard navigation support for enhanced usability and accessibility * Fix visibility of elements with aria-hidden attribute in header navigation (cassiopeia) * Refactor submenu toggle logic and improve focus handling for keyboard navigation * Refactor ID assignment logic for menu tag * Move submenu toggle creation to template file to make override possible * Remove console log statements from keydown event handling in navigation * Improve keyboard navigation by focusing the last tabbable element in the menu on 'End' key press * CS + lint * Fix aria-controls attribute to support multiple values for submenu toggle buttons * Replace span with button for submenu toggle to improve accessibility @todo css * Remove tabindex from submenu toggle buttons for improved accessibility * Add aria-label for submenu toggle button to enhance accessibility * Close all opened submenus before opening a new one in toggleSubMenu * Restrict submenu toggle button rendering to first-level items with subitems only * Add asset management for mod_menu and define CSS for submenu visibility * Refactor mod-menu CSS for improved submenu styling and toggle behavior Co-authored-by: Viviana Menzel <[email protected]> * Refactor mod-menu CSS * Remove paddig top for icons in menu item link rendering * Enhance constructor to support custom settings * Add navigation menu description to the code comments * Update copyright year * clean up * lint css * clean up * Fix refine toggle button logic for deeper menu items for heading and separator * Remove unused CSS comments and clean up mod-menu styles * Remove copyright change
1 parent 38f3927 commit a9b20c8

File tree

10 files changed

+319
-127
lines changed

10 files changed

+319
-127
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
:where(.mod-menu__toggle-sub) {
2+
display: inline-flex;
3+
align-items: center;
4+
padding: 0;
5+
color: currentColor;
6+
background-color: transparent;
7+
border: none;
8+
&[aria-expanded="true"] .icon-chevron-down {
9+
transform: rotate(180deg);
10+
}
11+
}
12+
:where(.mod-menu [class*="icon-"]) {
13+
margin-inline-start: .5rem;
14+
transition: all .2s, background-color .2s;
15+
}
16+
17+
:where(.mod-menu__sub[aria-hidden="true"]) {
18+
display: none;
19+
}
20+
:where(.mod-menu__sub[aria-hidden="false"]) {
21+
display: block;
22+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
3+
"name": "mod_menu",
4+
"version": "6.0.0",
5+
"description": "Joomla CMS",
6+
"license": "GPL-2.0-or-later",
7+
"assets": [
8+
{
9+
"name": "mod_menu.admin-menu",
10+
"type": "script",
11+
"uri": "mod_menu/admin-menu.min.js",
12+
"dependencies": [
13+
"core"
14+
],
15+
"attributes": {
16+
"type": "module"
17+
}
18+
},
19+
{
20+
"name": "mod_menu.menu",
21+
"type": "script",
22+
"uri": "mod_menu/menu.min.js",
23+
"dependencies": [
24+
"core"
25+
],
26+
"attributes": {
27+
"type": "module"
28+
}
29+
},
30+
{
31+
"name": "mod_menu.menu",
32+
"type": "style",
33+
"uri": "mod_menu/mod-menu.min.css"
34+
},
35+
{
36+
"name": "mod_menu.menu",
37+
"type": "preset",
38+
"dependencies": [
39+
"mod_menu.menu#style",
40+
"mod_menu.menu#script"
41+
]
42+
}
43+
]
44+
}

0 commit comments

Comments
 (0)