Skip to content

Revert onclick menus. #1104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions static/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@
e.preventDefault();
e.stopPropagation();
};
function menuMouseOver(e) {
if (currentMenu) {
if (e.target.className.indexOf("pure-menu-link") !== -1) {
e.target.focus();
if (e.target.parentNode.className.indexOf("pure-menu-has-children") !== -1 && e.target.parentNode !== currentMenu) {
closeMenu();
openMenu(e.target.parentNode);
}
}
}
}
function menuKeyDown(e) {
if (currentMenu) {
var children = currentMenu.querySelector(".pure-menu-children");
Expand Down Expand Up @@ -187,4 +198,5 @@
menu.firstElementChild.addEventListener("click", menuOnClick);
}
document.documentElement.addEventListener("keydown", menuKeyDown);
menu.addEventListener("mouseover", menuMouseOver);
})();
6 changes: 3 additions & 3 deletions templates/rustdoc/topbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<ul class="pure-menu-list">
{% if 'krate' in __tera_context %}
<li class="pure-menu-item pure-menu-has-children">
<a href="#" class="pure-menu-link" title="{{ krate.description }}">
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="{{ crate_url | safe }}" class="pure-menu-link" title="{{ krate.description }}">
{{ "cube" | fas }}
<span class="title">{{ krate.name }}-{{ krate.version }}</span>
</a>
Expand Down Expand Up @@ -210,7 +210,7 @@
</li>{#

Display the platforms that the release has been built for
#}<li class="pure-menu-item pure-menu-has-children">
#}<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="#" class="pure-menu-link" aria-label="Platform">
{{ "cogs" | fas }}
<span class="title">Platform</span>
Expand Down