Skip to content

Commit

Permalink
Allow expanding sidebar by clicking on non-links (OpenZeppelin#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio authored Sep 1, 2023
1 parent 9ae87f1 commit f943c10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 3 additions & 4 deletions ui/src/css/specific/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@
font-size: 1rem;
}

.nav-li {
a:hover {
opacity: .8;
}
.nav-link:hover {
opacity: .8;
cursor: pointer;
}

.nav-link code {
Expand Down
7 changes: 4 additions & 3 deletions ui/src/js/05-sidr-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
if (isDefaultCollapsed && !o.parentElement.classList.contains('nav-li-active-parent')) {
o.classList.toggle('toggled');
}
o.addEventListener('click', function (e) {
this.classList.toggle('toggled');
});
const toggle = () => o.classList.toggle('toggled');
o.addEventListener('click', toggle);
const span = [...o.parentElement.children].find(c => c.matches('span.nav-link'));
span?.addEventListener('click', toggle);
});

// The preinit class sets up collapsed states before JS executes to avoid flashing uncollapsed menu
Expand Down
2 changes: 1 addition & 1 deletion ui/theme/partials/navigation-tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{{content}}}
</a>
{{else}}
{{#if content}}<span>{{{content}}}</span>{{/if}}
{{#if content}}<span {{#if items}}class="nav-link"{{/if}}>{{{content}}}</span>{{/if}}
{{/if}}
{{!-- Nesting --}}
{{#if items}}
Expand Down

0 comments on commit f943c10

Please sign in to comment.