rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.37k stars 1.65k forks source link

feat: keyboard shortcut to toggle sidebar #2343

Open hamirmahal opened 8 months ago

hamirmahal commented 8 months ago

closes #2342.

hamirmahal commented 8 months ago

https://github.com/rust-lang/mdBook/commit/a7da1d0badfe6b9dd1f7583524da09ee93d31a43#diff-e285923a1141a0d66175574c5c81d62f6f08c33202f9748e40fb512c28ae33daR599-R606

Screencast_from_03-21-2024_093421_PM.webm

hamirmahal commented 6 months ago

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