Skip to content

Commit

Permalink
Merge pull request #945 from web-illinois/top-nav-nolink-fix
Browse files Browse the repository at this point in the history
Fix for top-level nav item issue #944
  • Loading branch information
trubach authored Oct 27, 2023
2 parents 227b8e6 + b0ba275 commit 97c8dc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions scss/web-components/_web-components.menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ il-nav-section {
color: unset;
text-decoration: unset;
}

// If top-level nav item doesn't have a link, change the cursor to default
a:not([href]):not([class]), a:not([href]):not([class]):hover {
cursor: default;
}
}
il-nav-link {
a {
Expand Down
7 changes: 6 additions & 1 deletion templates/navigation/menu--main--nav-main.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
{% set item_length = items|length %}
{% if menu_level == 0 and item.below %}
<il-nav-section {% if item_length >= 5 and loop.index > (item_length - 2) %}right="true"{% endif %}>
<a href="{{ item.url }}" slot="label">{{ item.title }}</a>
{# Check if there's <nolink> in the top-level menu link and remove the href if there is no link #}
{% if item.url.toString is not empty -%}
<a href={{ item.url }} slot="label">{{ item.title }}</a>
{% else %}
<a role="button" slot="label" tabindex="0">{{ item.title }}</a>
{% endif -%}
<ul class="il-subnav">
{% for item in item.below %}
<li>
Expand Down

0 comments on commit 97c8dc0

Please sign in to comment.