From 31f939002faf1afc7db5c0ae48f225c850e966c7 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Thu, 8 Oct 2026 15:12:27 -0400 Subject: [PATCH] feat(web): 'a' keyboard shortcut toggles the annotations drawer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The drawer was the only top-bar tool without a keyboard shortcut, so the shortcuts & gestures help modal had to describe it as '๐Ÿ“ button'. Bind plain 'a' to toggleBookmarks(), following the same pattern as the existing t/s/b letter shortcuts. - reader.ts: new 'a' branch in handleKeydown, guarded against Ctrl/Cmd/Alt so Select All (a common reader action when selecting text to highlight/copy) is never intercepted; typing guard already protects note textareas, search box, and selects. Works in both the host page and book-content iframes since both keydown listeners route through handleKeydown. - reader.templ: help modal row now shows a like the other letter shortcuts; ๐Ÿ“ button tooltip gains '(a)' to match its siblings (b), (/), (s), (?). - reader_templ.go: regenerated. --- templates/reader.templ | 4 ++-- templates/reader_templ.go | 4 ++-- web/src/reader/reader.ts | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/reader.templ b/templates/reader.templ index 8cf1f622..35251e32 100644 --- a/templates/reader.templ +++ b/templates/reader.templ @@ -277,7 +277,7 @@ templ Reader(user User, metadata ReaderMetadata) {
Page edge zones (desktop)click page edges
Search in book/
Contents / thumbnailst
-
Annotations drawer๐Ÿ“ button
+
Annotations drawera
Settingss
Add bookmarkb
Close menus / toggle chromeEsc
@@ -311,7 +311,7 @@ templ ReaderChrome(metadata ReaderMetadata) {
- +
diff --git a/templates/reader_templ.go b/templates/reader_templ.go index 94dc60da..ab94b6e9 100644 --- a/templates/reader_templ.go +++ b/templates/reader_templ.go @@ -139,7 +139,7 @@ func Reader(user User, metadata ReaderMetadata) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

Shortcuts & Gestures

Navigation

Previous / next pageโ†โ†’ or hl
Return to previous locationAlt+โ†
Page edge zones (desktop)click page edges
Search in book/
Contents / thumbnailst
Annotations drawer๐Ÿ“ button
Settingss
Add bookmarkb
Close menus / toggle chromeEsc

Zoom & pan (comics, PDFs)

Zoom in / out / reset+โˆ’0 or wheel
Move the pagedrag with the mouse
Recenter (keeps zoom)โŠ™ button
Select text in a PDFSmart mode: drag over text ยท Shift+drag anywhere ยท Text mode

Highlights

Createselect text โ†’ pick a color
Edit / deleteclick the highlight

Touch

Page turnswipe, or tap outer edges
Toggle chrometap center
Zoom / movepinch ยท two-finger drag ยท double-tap
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

Shortcuts & Gestures

Navigation

Previous / next pageโ†โ†’ or hl
Return to previous locationAlt+โ†
Page edge zones (desktop)click page edges
Search in book/
Contents / thumbnailst
Annotations drawera
Settingss
Add bookmarkb
Close menus / toggle chromeEsc

Zoom & pan (comics, PDFs)

Zoom in / out / reset+โˆ’0 or wheel
Move the pagedrag with the mouse
Recenter (keeps zoom)โŠ™ button
Select text in a PDFSmart mode: drag over text ยท Shift+drag anywhere ยท Text mode

Highlights

Createselect text โ†’ pick a color
Edit / deleteclick the highlight

Touch

Page turnswipe, or tap outer edges
Toggle chrometap center
Zoom / movepinch ยท two-finger drag ยท double-tap
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -194,7 +194,7 @@ func ReaderChrome(metadata ReaderMetadata) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
โ€”
โ€”
0/0
Zoom
Fit
Page position
Magnifier
Night mode
Pointer
Double page
Contents
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
โ€”
โ€”
0/0
Zoom
Fit
Page position
Magnifier
Night mode
Pointer
Double page
Contents
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/web/src/reader/reader.ts b/web/src/reader/reader.ts index 505c0dc9..97bd8f07 100644 --- a/web/src/reader/reader.ts +++ b/web/src/reader/reader.ts @@ -3535,6 +3535,9 @@ document.addEventListener("alpine:init", () => { if (k === "t") this.toggleTOC(); else if (k === "s") this.toggleSettings(); else if (k === "b") this.addBookmark(); + else if (k === "a") { + if (!event.ctrlKey && !event.metaKey && !event.altKey) this.toggleBookmarks(); + } else if (k === "?") this.toggleHelp(); else if (k === "/") { event.preventDefault();