fix(reader): arrows stay page turns while the progress slider holds focus

Clicking the bottom progress slider left it focused, and the reader's
keydown guard treats INPUT focus as typing — so arrow keys stepped the
range input instead of turning pages. With step="any" each press moved
~1% of the book and key repeat crossed the whole book in seconds; the
debounced progress saves then persisted every wild landing (positions
scattered from page 5 to 285 to 100%, "progress no longer saves
correctly after page turns").

Two layers:
- reader.templ: all three progress sliders blur on pointerup, so a
  mouse scrub no longer leaves focus behind.
- reader.ts handleKeydown: ArrowLeft/ArrowRight on a focused progress
  slider preventDefault, blur, and fall through to the page-turn
  handlers; every other key still belongs to the control, so a
  keyboard user who Tabbed to the slider keeps arrows for it.
This commit is contained in:
John O'Keefe committed 2026-10-21 20:21:07 -04:00
1 parent 6791d611f0
commit 807899b137
3 files changed
+18 -3

No files matched your search

+3
View File
@@ -350,6 +350,7 @@ templ ReaderChrome(metadata ReaderMetadata) {
step="any"
list="tick-marks"
@input="goToFraction($event.target.value)"
@pointerup="$el.blur()"
class="grow"
/>
<datalist id="tick-marks"></datalist>
@@ -392,6 +393,7 @@ templ ReaderChrome(metadata ReaderMetadata) {
max="1"
step="any"
@input="goToFraction($event.target.value)"
@pointerup="$el.blur()"
class="grow min-w-[3rem]"
/>
<button @click="goRight()" class="p-1.5 sm:p-2 rounded-lg hover:bg-gray-700" title="Go Right (→)" aria-label="Go right">
@@ -482,6 +484,7 @@ templ ReaderChrome(metadata ReaderMetadata) {
max="1"
step="any"
@input="goToFraction($event.target.value)"
@pointerup="$el.blur()"
class="grow min-w-[3rem]"
/>
<button @click="goRight()" class="p-1.5 rounded-lg hover:bg-gray-700" title="Go Right (→)" aria-label="Go right">