Skip to content

Add some keyboard interactions with the website first pages #324

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

Merged
merged 1 commit into from
Apr 11, 2019

Conversation

GuillaumeGomez
Copy link
Member

It'd be nice to navigate using the keyboard only on the first pages (on the crates pages, I prefer to not touch them by adding new shortcuts for the moment).

If someone could double-check too, it'd be very appreciated. :)

@@ -31,6 +54,59 @@
<div class="release">
<a href="/releases"><strong>Recent Releases</strong></a> <a href="/releases/feed" title="Atom feed"><i class="fa fa-rss-square"></i></a>
</div>
{{else}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the JS that registers the key handlers in the else branch of the template? Wouldn't that make it not appear on the front page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the whole point! I want to be able to navigate through my search results, not on the front page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doesn't this also register the "S" shortcut?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the "S" shortcut is "registered" through handleShortcut whereas the up and down arrows are "registered" through handleKey.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, i see it now. I was confused because this also registered "S", but that's probably because the handler overwrites document.onkeypress/document.onkeydown. This looks fine, then.

@QuietMisdreavus QuietMisdreavus merged commit 53f67d1 into rust-lang:master Apr 11, 2019
@GuillaumeGomez GuillaumeGomez deleted the add-interactions branch April 11, 2019 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants