Repository navigation
fix(pos): ignore repeated checkout confirmation - #1117
Conversation
|
@greptile review |
|
|
The production fix looks good, but the remaining Greptile finding needs to be addressed before merging.
Please keep the changes focused on the test issue. No unrelated formatting or refactoring. |
d399d9d to
ef193aa
Compare
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Guard repeated keydown events (e.repeat) after preventDefault() on the POS canvas Space tender branch and the PrepaidCheckoutModal Space/Enter confirmation branch so holding Space to open checkout cannot auto-confirm payment without a deliberate second press. Fixes #1066
ef193aa to
6877806
Compare
Fixes #1066
Intent
Implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1066 ("Holding Space bar auto-confirms checkout"): guard repeated keydown events (
e.repeat) aftere.preventDefault()on the Space/tender branch infrontend/src/hooks/usePosKeyboardShortcuts.tsand on the Space/Enter confirmation branch infrontend/src/components/pos/PrepaidCheckoutModal.tsxso holding Space to open checkout cannot auto-confirm payment without a deliberate second press. Deliver via theno-mistakespipeline as its own PR (Fixes #1066).What Changed
keydownevents (e.repeat) aftere.preventDefault()on the Space tender handler inusePosKeyboardShortcutsand on the Space/Enter confirmation handler inPrepaidCheckoutModal, requiring a fresh key press to confirm payment.tests/pos-keyboard-shortcuts.test.tsand browser E2E tests infrontend/e2e/pos-keyboard-shortcuts.spec.tscovering repeated Space/Enter events, typing-target and button immunity, and initial vs. repeated key presses.Risk Assessment
✅ Low: The change is a minimal, well-bounded two-line guard on repeated keydown events after preventDefault() in the POS keyboard shortcut hook and prepaid checkout modal, backed by unit and E2E behavioral regression tests.
Testing
Ran
npm run test:pos-keyboard-shortcuts, built the backend and static frontend (npm run build && npm run build:frontend), executed all 6 Playwright E2E tests infrontend/e2e/pos-keyboard-shortcuts.spec.tsagainst an isolated live FloCafe instance, and captured visual screenshots plus JSON telemetry proving that repeatedSpaceandEnterkeydown events (e.repeat === true) callpreventDefault()without opening or auto-confirming checkout, while a fresh non-repeatSpaceorEnterpress after key release settles the order once.e.repeat = true) on the POS canvas with items in cart; default scrolling is prevented and the prepaid checkout modal does not open until an initial non-repe…~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B54G9H/issue-1066-modal-remains-open-on-repeat-space-enter.pngand `~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B5…keyup), pressing a fresh non-repeat Space or Enter inside the prepaid checkout modal confirms payment exactly once, closes the modal, clears the cart, and increments pa…~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B54G9H/issue-1066-order-settled-after-fresh-space.pngande2e/pos-keyboard-shortcuts.spec.ts/search focus,+/-quantity adjustments including key repeat,F2table picker,F4checkout,?help modal, and typing immunity in inputs/buttons) continue…npm run test:pos-keyboard-shortcutsande2e/pos-keyboard-shortcuts.spec.tsEvidence: Live browser keyboard event and network request verification summary (JSON)
{"repeatCanvasPrevented":true,"modalVisibleOnCanvasRepeat":false,"repeatSpacePrevented":true,"repeatEnterPrevented":true,"modalStillVisibleAfterRepeats":true,"ordersAfterRepeats":0,"paymentsAfterRepeats":0,"ordersAfterFreshSpace":1,"paymentsAfterFreshSpace":1}Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
e.repeat = true) on the POS canvas with items in cart; default scrolling is prevented and the prepaid checkout modal does not open until an initial non-repe…~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B54G9H/issue-1066-modal-remains-open-on-repeat-space-enter.pngand `~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B5…keyup), pressing a fresh non-repeat Space or Enter inside the prepaid checkout modal confirms payment exactly once, closes the modal, clears the cart, and increments pa…~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B54G9H/issue-1066-order-settled-after-fresh-space.pngande2e/pos-keyboard-shortcuts.spec.ts/search focus,+/-quantity adjustments including key repeat,F2table picker,F4checkout,?help modal, and typing immunity in inputs/buttons) continue…npm run test:pos-keyboard-shortcutsande2e/pos-keyboard-shortcuts.spec.tsnpm run test:pos-keyboard-shortcutsnpm run build && npm run build:frontendE2E_BASE_URL=http://127.0.0.1:43101 E2E_KDS_BASE_URL=http://127.0.0.1:43102 E2E_SERVER_APP_BASE_URL=http://127.0.0.1:43103 npx playwright test --config=playwright.config.ts --project=chromium e2e/pos-keyboard-shortcuts.spec.tsLive Chromium verification script againsttests/e2e-server.cjson isolated ports43201/43202/43203capturing screenshots and JSON telemetry in~/.no-mistakes/evidence/01M4VGR470XCCGWQCXT3B54G9H✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.