Skip to content
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

feat: keyboard shortcut to toggle sidebar #2343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hamirmahal
Copy link
Contributor

closes #2342.

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Mar 22, 2024
Copy link
Contributor Author

@hamirmahal hamirmahal left a comment

Choose a reason for hiding this comment

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

I would have liked to do this in https://github.com/rust-lang/mdBook/blob/master/src/theme/book.js#L443, but for some reason this keyboard shortcut wasn't working there, while the click handler worked without issue.

@hamirmahal
Copy link
Contributor Author

a7da1d0#diff-e285923a1141a0d66175574c5c81d62f6f08c33202f9748e40fb512c28ae33daR599-R606

Screencast_from_03-21-2024_093421_PM.webm

@hamirmahal
Copy link
Contributor Author

@Dylan-DPC I tried to do this in a cleaner way with hamirmahal@a7da1d0, but document.addEventListener("keydown", function (event) { wasn't working with that commit, while clicking still toggled the sidebar without issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a keyboard shortcut to toggle the sidebar
2 participants