fixed a bug where all links under an aria-current="page" submenu heading would be underlined

This commit is contained in:
eclipse 2025-02-19 09:50:15 +01:00
parent e74ecbd799
commit 32ef823d34
2 changed files with 5 additions and 2 deletions

View File

@ -183,7 +183,8 @@ a {
padding-right: 0;
}
li[aria-current=page] a {
li[aria-current=page]>a,
li[aria-current=page]>details>summary>a {
text-decoration: underline;
}

View File

@ -9,12 +9,14 @@
<ul id="main-menu-items" role="list">
{% for title, link in MENUITEMS %}
{% if link is iterable and link is not string %}{% set submenu = true %}{% endif %}
<li role="listitem"{% if output_file[-10:] == "index.html" and (output_file[:-10] == link or (submenu and output_file[:-10] == link[0][1])) %} aria-current="page"{% endif %}>
{# aria-current tells the browser which menu link corresponds to the current page #}
<li role="listitem"{% if output_file[-10:] == "index.html" and (output_file[:-10] == link or (submenu and output_file[:-10] == link[0][1])) %} aria-current="page"{% endif %}{% if submenu %} aria-haspopup="menu"{% endif %}>
{% if submenu %}
<details class="dropdown">
<summary><a href="{{ SITEURL }}/{{ link[0][1]}}">{{ title }}</a></summary>
<ul>
{% for t, l in link %}
{# skip first submenu entry as it contains only the link for the summary (which has already been set) #}
{% if not loop.first %}
<li role="listitem"{% if output_file[-10:] == "index.html" and output_file[:-10] == l %} aria-current="page"{% endif %}><a href="{{ SITEURL }}/{{ l }}">{{ t }}</a></li>
{% endif %}