feat: make the batch scanner the Add Book page's default tab #98

Merged
jfro merged 4 commits from feat/batch-scanner-tab into main 2026-10-25 23:21:52 +00:00
Owner

Closes #93. Stacked on #85 and #90 (both batch-scanner fixes, merged into this branch); review the last commit. Once #85 and #90 merge, this PR's diff shrinks to that commit.

  • The batch scanner markup + script moves into book_html/batch_scanner_panel.html.heex (wrapped in #batch-scanner-panel). batch_scanner.html.heex (its own page at /books/batch-scanner) now renders <.batch_scanner_panel />; nothing else in the scanner changed.
  • Add Book gets a first tab Batch Scanner (#tab-batch), checked by default. #76's remembered tab still wins, so a user who last picked Title Search gets Title Search.
  • scannerActive() (panel visible): on Add Book the global key listener, the "Scanner paused" notice and the wake lock only apply while the batch tab is showing; switching tabs releases the wake lock and re-arms it on return.
  • Key filter now ignores only text-like inputs, so a focused tab radio/checkbox/button no longer swallows scans (after clicking the tab, focus sits on its radio).

Tests: batch_scanner_tab_test.exs (default tab and order, panel once inside a tabpanel, remember-tab wrapper, standalone page); #84's tab-id test updated. mix precommit: 638 tests pass. Nye's #90 jsdom XSS proofs pass against the new panel file.
Browser check (Chromium, dev server): fresh storage opens on Batch Scanner; a simulated scan adds a row; a scan with focus on the tab radio counts; on Title Search typing reaches the field and scans aren't captured; reload reopens Title Search; standalone page still scans.

Closes #93. **Stacked on #85 and #90** (both batch-scanner fixes, merged into this branch); review the last commit. Once #85 and #90 merge, this PR's diff shrinks to that commit. - The batch scanner markup + script moves into `book_html/batch_scanner_panel.html.heex` (wrapped in `#batch-scanner-panel`). `batch_scanner.html.heex` (its own page at `/books/batch-scanner`) now renders `<.batch_scanner_panel />`; nothing else in the scanner changed. - Add Book gets a first tab **Batch Scanner** (`#tab-batch`), `checked` by default. #76's remembered tab still wins, so a user who last picked Title Search gets Title Search. - `scannerActive()` (panel visible): on Add Book the global key listener, the "Scanner paused" notice and the wake lock only apply while the batch tab is showing; switching tabs releases the wake lock and re-arms it on return. - Key filter now ignores only text-like inputs, so a focused tab radio/checkbox/button no longer swallows scans (after clicking the tab, focus sits on its radio). **Tests:** `batch_scanner_tab_test.exs` (default tab and order, panel once inside a tabpanel, remember-tab wrapper, standalone page); #84's tab-id test updated. `mix precommit`: 638 tests pass. Nye's #90 jsdom XSS proofs pass against the new panel file. **Browser check (Chromium, dev server):** fresh storage opens on Batch Scanner; a simulated scan adds a row; a scan with focus on the tab radio counts; on Title Search typing reaches the field and scans aren't captured; reload reopens Title Search; standalone page still scans.
jfro added this to the v0.9.0 milestone 2026-10-25 22:12:33 +00:00
fix: escape provider text in the batch scanner
All checks were successful
CI / test (pull_request) Successful in 47s
2dc4c04362
Book titles, authors and errors from providers (Open Library records are
publicly editable) went into innerHTML in result rows and toasts, so a
title like <img onerror=...> ran script in the signed-in session. Escape
them with a small esc() helper, and set toast and status text via
textContent.
fix: let the batch scanner's results scroll with the page
All checks were successful
CI / test (pull_request) Successful in 47s
cce77a211e
The results list was its own fixed-height scroll box on desktop; it now
grows with the page (newest first) and uses the page's scrolling.

Closes #81
feat: make the batch scanner the Add Book page's default tab
All checks were successful
CI / test (pull_request) Successful in 47s
faa161dd1a
The batch scanner moves into a batch_scanner_panel template used by
both its own page and a new first tab on Add Book, which opens by
default unless another tab was picked last time (#76's remembered tab).
On Add Book it only listens for scans, shows the paused notice and
holds the wake lock while its tab is showing, so typing on other tabs
is left alone; a focused tab radio no longer swallows scans.

Closes #93
fix: drop the batch scanner wake lock if its tab closed mid-request
All checks were successful
CI / test (pull_request) Successful in 47s
d8bcad3b86
When Add Book reopened on a remembered tab, the tab switch landed while
the wake lock request was still pending, so the screen stayed awake on a
tab with no scanner. Release the lock if the scanner tab isn't showing
once the request resolves, and don't start a second request while one is
pending. Found by Nye (F5).
Merge remote-tracking branch 'origin/main' into feat/batch-scanner-tab
All checks were successful
CI / test (pull_request) Successful in 47s
fa1366f287
jfro merged commit 9d92260249 into main 2026-10-25 23:21:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/fuzzy_catalog!98
No description provided.