Skip to content

feat: keyboard shortcut to toggle sidebar #2343

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

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

@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.

@rustbot

This comment has been minimized.

@hamirmahal hamirmahal force-pushed the feat/keyboard-shortcut-to-toggle-sidebar branch 2 times, most recently from 1d44c61 to 1dda4d3 Compare May 10, 2025 22:55
@hamirmahal hamirmahal force-pushed the feat/keyboard-shortcut-to-toggle-sidebar branch from 1dda4d3 to e744bc2 Compare May 10, 2025 22:59
@hamirmahal
Copy link
Contributor Author

With this change

With this pull request, users would be able to collapse, and expand, the sidebar with just their keyboard.

2025-05-10_15.59.49.mp4

@hamirmahal
Copy link
Contributor Author

@ehuss are there any changes you'd like me to make here?

I fixed the merge conflicts.

It's been around 414 days or so since I opened this pull request. I'm hoping we can get it across the finish line.

@hamirmahal
Copy link
Contributor Author

@y21 would you happen to know how I can get feedback from ehuss?

I think this feature could make life easier for a lot of mdBook users. I'm trying to avoid running into merge conflicts again.

@y21
Copy link
Member

y21 commented May 18, 2025

Sorry, I don't know about the reviewing process in this repo here, usually (at least in clippy and the Rust repo) the standard wait time is 14 days, at which point a reviewer can be rerolled with r? team.
But it looks like this repo only has two maintainers, and it seems there's quite a few other PRs waiting on feedback, too.

This does look like a useful feature though 👍

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
3 participants