Repository navigation
Reader: Escape in a dialog no longer closes the book - #971
Merged
Merged
Conversation
Pressing Escape to close the metadata or Match Review dialog also closed
the book, and arrow keys, space, j/k and the other shortcuts paged or
changed settings underneath an open dialog.
The reader's three document keyup listeners only bailed out on the auth
store's isAuthDialogOpen flag. That misses Escape for every dialog, auth
dialogs included: Vuetify closes an overlay on Escape keydown and moves
focus back to its activator, so by keyup the dialog flag is already
false and the keyup target is the toolbar button, outside any overlay.
Checked in a real browser: event.target.closest(".v-overlay") at keyup
misses whenever the dialog was opened from a visible activator.
useReaderKeyUp decides on keydown instead. A capture-phase keydown
listener records each key pressed inside a .v-overlay (capture so a
dialog that stops keydown still counts; repeats are ignored so a held
Escape stays with the dialog), and the keyup listener skips those keys
and any keyup whose own target is inside an overlay. All three reader
listeners use it. This covers the auth dialogs too, so the
isAuthDialogOpen getter, which had no other users, is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In the reader, pressing Escape to close the metadata dialog (
m) or the online-tag Match Review dialog also closed the book. While either dialog was open, arrow keys, space, j/k, n/p and the fit/direction keys also acted on the reader underneath it.isAuthDialogOpen. Vuetify closes an overlay on Escape keydown and moves focus back to its activator, so by keyup the dialog flag is false and the keyup target is the toolbar button, outside any overlay.useReaderKeyUpcomposable (frontend/src/components/reader/use-reader-keyup.js). A capture-phase keydown listener records keys pressed inside a.v-overlay; the keyup listener skips those keys and any keyup whose own target is in an overlay. All three listeners use it. It covers the auth dialogs too, so the now-unusedisAuthDialogOpengetter is removed.Why keydown, not
closest()at keyupLogged real key events in the browser. With the metadata dialog opened from the visible Tags button, Escape went:
.v-overlay.v-overlay__contentSo a keyup-time
event.target.closest('.v-overlay')check misses whenever the dialog was opened from a visible activator. It only happens to work whenmopened it with the toolbars hidden.Browser verification (dev stack, fresh DB, generated CBZ)
mopens metadata. Inside it, ArrowRight ×2 andjdon't page. Escape closes the dialog and stays in the reader.ndo nothing underneath it. Escape closes only the dialog.m,n) doesn't open metadata or change books. Escape closes only the dialog. The oldisAuthDialogOpencheck missed this Escape too.Tests
frontend/tests/unit/use-reader-keyup.test.jscovers:make fix,make lintandmake testall pass: vitest 994 passed; pytest 1662 passed, 1 xfailed.🤖 Generated with Claude Code