Skip to content

Commit bcfcccd

Browse files
committed
Use native buttons instead of links
- link with no href is not focusable - button handle natively space and enter
1 parent 4febe1d commit bcfcccd

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

css/includes/components/_global-menu.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
.topbar {
6161
#navbar-menu {
6262
.nav-item {
63-
a.nav-link {
63+
.nav-link {
6464
color: var(--glpi-mainmenu-fg);
6565

6666
&:hover {
@@ -69,7 +69,7 @@
6969
}
7070

7171
&:not(.active) {
72-
a.nav-link {
72+
.nav-link {
7373
opacity: 0.7;
7474
}
7575
}

templates/layout/parts/menu.html.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@
5050
{% endif %}
5151
{% if has_subitems %}
5252
<li class="nav-item dropdown {{ firstlevel_active ? 'active' : '' }}" aria-label="{{ firstlevel['title'] }}">
53-
<a class="nav-link dropdown-toggle {{ firstlevel_active ? 'active' : '' }} {{ firstlevel_shown ? 'show' : '' }}"
54-
data-bs-toggle="dropdown" role="button"
53+
<button type="button"
54+
class="nav-link dropdown-toggle {{ firstlevel_active ? 'active' : '' }} {{ firstlevel_shown ? 'show' : '' }}"
55+
data-bs-toggle="dropdown"
5556
data-testid="sidebar-menu-toggle"
5657
aria-expanded="{{ firstlevel_shown ? 'true' : 'false' }}">
5758
<i class="{{ firstlevel['icon'] ?? '' }}"></i>
5859
<span class="menu-label">{{ firstlevel['title'] }}</span>
59-
</a>
60+
</button>
6061
<div class="dropdown-menu {{ firstlevel_active and is_vertical != false ? '' : 'animate__animated' }} {{ is_vertical ? 'animate__fadeInLeft' : 'animate__zoomIn' }} {{ firstlevel_shown ? 'show' : '' }}">
6162
<h6 class="dropdown-header">{{ firstlevel['title'] }}</h6>
6263
<div class="dropdown-menu-columns">

0 commit comments

Comments
 (0)