Skip to content

feat: implement F4/F8/F9 keyboard shortcuts#230

Open
NotAbdelrahmanelsayed wants to merge 1 commit intoBrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/keyboard-shortcuts-f4-f8-f9
Open

feat: implement F4/F8/F9 keyboard shortcuts#230
NotAbdelrahmanelsayed wants to merge 1 commit intoBrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/keyboard-shortcuts-f4-f8-f9

Conversation

@NotAbdelrahmanelsayed
Copy link
Copy Markdown
Contributor

Summary

  • F4 — focuses the item search input (ItemsSelector.focusSearchInput, already exposed)
  • F8 — focuses the customer search input in the cart (new InvoiceCart.focusCustomerSearch via defineExpose)
  • F9 — triggers checkout (handleProceedToPayment, includes existing cart/customer validation)

These shortcuts were listed in the README but had zero implementation in the codebase.

Changes

  • POSSale.vue: adds ref="invoiceCartRef" on <InvoiceCart>, declares invoiceCartRef, and registers a global window.keydown listener (cleaned up on unmount) that dispatches F4/F8/F9
  • InvoiceCart.vue: adds ref="customerSearchInputRef" on the native search <input>, declares the ref, and exposes focusCustomerSearch() via defineExpose

Guards

  • Shortcuts no-op when uiStore.isAnyDialogOpen is true
  • Shortcuts no-op when document.activeElement is an INPUT or TEXTAREA

Test plan

  • Open POS, press F4 — item search input gains focus
  • Press F8 — customer search input in cart gains focus
  • Add items to cart, press F9 — payment dialog opens (or warning if no customer required)
  • Open any dialog, press F4/F8/F9 — nothing happens
  • Click into a quantity field, press F4/F8/F9 — nothing happens

🤖 Generated with Claude Code

Add global keydown listener in POSSale.vue to wire up the keyboard
shortcuts that were documented in the README but never implemented:
- F4: focus item search (ItemsSelector)
- F8: focus customer search (InvoiceCart)
- F9: proceed to checkout (handleProceedToPayment)

Expose focusCustomerSearch() from InvoiceCart via defineExpose so the
parent can programmatically focus the customer search input.

Shortcuts are blocked when a dialog is open or when focus is already
inside an input/textarea to avoid conflicting with user typing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@engahmed1190
Copy link
Copy Markdown
Contributor

#166 We will consildate both in one branch to make it better Feature.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity for 21 days.

To keep this PR open, please:

  • Rebase on the latest develop branch
  • Address any pending review comments
  • Reply with an update on the PR status

If no further activity occurs within the next 14 days, this PR will be automatically closed.

@github-actions github-actions Bot added the stale label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants