fix: make the batch scanner and Add Book work on iPhone and iPad #71
Loading…
Reference in a new issue
No description provided.
Delete branch "mobile/scanner"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the mobile pass. Makes the batch scanner and Add Book (with its camera modal) work well on iPhone (393x852) and iPad (820x1180, portrait and landscape), light and dark. Two commits, one per page.
Batch scanner (with a Bluetooth/USB scanner)
console.info('[batch-scanner] …')logs each scan (chars, ms, how it ended, queue length) and focus changes, for debugging on a device with Web Inspector.pointer-coarse:): 44px media type buttons, a plain View Book link instead of a one-item ⋮ menu, and the results list scrolls with the page instead of a nestedmax-h-96box. Desktop (fine pointer) looks the same as before.Add Book + camera modal
app.css: on touch screens, fields get at least 16px text so iOS Safari doesn't zoom in on focus, and default-size.input/.selectare 44px tall. This is global (all forms on touch devices); it's the standard iOS fix and the other-pages PR will build on it.object-fit: cover) instead of showing at native size cropped to the top-left; the guide box fits inside it on a phone; the info alert is hidden on phones to give the video room. Quagga is kept as is.Checked
mix precommit: 635 tests pass, no warnings.btn-xs; addingpointer-coarse:h-11there would make it an easy tap on iPad.Not covered
Screenshots (Playwright WebKit)
pr-batch-iphone
pr-batch-iphone-dark
pr-paused-iphone
pr-batch-ipad-dark
pr-batch-ipad-land
pr-new-iphone
pr-camera-iphone
1f578f2267345b3887f3Rebased onto main (v0.7.0,
902e363) and pushed. New head345b388adds one commit:Full mobile check (393, 820, 1180, light+dark): 0 problems. mix precommit: 635 tests pass.
Review from Nye (changes) — covers head
1f578f2Ran the branch locally (dev, Playwright WebKit, iPhone 393x852 / 852x393) with the audit checks in scripts/mobile_check.py and hid_sim.py.
Works
mobile_check.py input-zoomnow PASSES on /books, /books/new, /books/batch-scanner, /books/1/edit, /users/settings. The globalpointer: coarserule does it.hid_sim.py enter|tab|select-focused|button-focusedall pass (2 of 2 scans POST each). Tab-ends-scan only mid-scan is the right call.902e363(with #70). No other review threads open.[batch-scanner] scan {chars, ms, endedBy, queued}, focus/blur) are good.Blocking: F1 is not fixed on iPhone landscape
mobile_check.py camera-modalstill FAILS at 852x393:{'vh': 393, 'box': 393, 'buttons': [['✕', 24, 68], ['Cancel', 399, 443]]}. Layout measured: header 24-68, info alert 84-130, scanner area 146-382 (236px), Cancel/status row 398-442.Cause: the
max-sm:variants (hide alert, full-width box, padding) don't apply in landscape because the width is 852 (>= sm).h-[min(600px,60svh)]+ alert + header + footer is ~466px in a 393px viewport, so the status line and Cancel need an inner scroll.Suggested fix (either):
.modal-boxflex flex-col max-h-[100svh]and give#barcode-scannerflex-1 min-h-0(drop the fixed height on short screens), and hide the info alert on short screens with a height variant like[@media(max-height:500px)]:hidden; orh-[min(600px,calc(100svh-10rem))]and hide the alert undermax-height:500px.Please prove F1 fixed with
timeout 120 python3 mobile_check.py camera-modal(sent you the script).Requested (from the iOS research; small)
navigator.wakeLock?.request('screen')on load, re-request onvisibilitychangewhen visible,console.info/warnon success/failure. Safari supports it (16.4+, and in Home Screen web apps since 18.4); without it an iPad on a stand auto-locks mid-batch and the HID scans go nowhere.visibilitychange(not only window blur/focus) for the "Scanner paused" banner: on iOS switching apps fires visibility changes more reliably than blur.Not in this PR (fine): F3 row actions, F4 hover-only, F5 export/import sideways scroll still fail as expected; they're for mobile/pages.
Nit (pre-existing, not introduced here): result items build HTML with
${data.book.title}/authorinto innerHTML; a title with<would be parsed as markup. Worth escaping in a follow-up.Review from Nye (approved) — covers head
2a6f174Ran the branch locally (dev, Playwright WebKit at iPhone 393x852 / 852x393 and iPad 820x1180) with the audit checks.
Works
2a6f174; merges cleanly with #72.Non-blocking notes
pointerdownfrom a touch isn't a user-activation event in the HTML spec (touch activation comes onpointerup/touchend/click), so on iPad/iPhone the first-tap retry may not unlock speech or get the wake lock. The first scan's keydown still does both, so it works in practice. If you touch it again, listen forclick(orpointerup) instead ofpointerdown.requestWakeLock()calls racing before the first resolves could take two locks; harmless (both released on hide).