-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add pop-up window showing the keyboard shortcuts #2608
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
Conversation
How would a regular user know about the Looking at the code, it seems like the shortcut is only active when shift is being held. On custom keyboard layouts the user might not have to press shift to write |
I thought if this is accepted then I'd suggest to also add an icon to the menu to show a question mark. You are right about the shift. I'll have to check how to catch |
Make it display when the user presses `?`. Implements rust-lang#2607
Also handle the ? key with or without shift being pressed.
According to https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode the keyCode is deprecated (and removed). It is causing me some difficulty with the GUI tests because it can't differentiate between a slash and question mark correctly. Using keys seems to work.
This makes a few changes to the help popup: - Move css to chrome.css, since this is a UI element. - Move HTML code to index.hbs instead of generated in JavaScript. In general I prefer to keep HTML out of JavaScript when possible, and I didn't see a particular reason to avoid it. - Added a click handler to dismiss the popup. - Make sure handlers get removed when dismissed. - Use `mdbook-` prefixes for IDs to avoid collisions with headers. - Don't show search if it isn't enabled. - Add the new `/` shortcut. - Use flex layout for better positioning. - Dim out the surrounding text using an overlay. - Various other styling tweaks. - Add a GUI test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I pushed some updates to adjust some of the styling and layout.
Make it display when the user presses
?
.Implements #2607