Skip to content

feat: select first search result on Enter key press#239

Open
NotAbdelrahmanelsayed wants to merge 1 commit intoBrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/search-enter-first-result
Open

feat: select first search result on Enter key press#239
NotAbdelrahmanelsayed wants to merge 1 commit intoBrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/search-enter-first-result

Conversation

@NotAbdelrahmanelsayed
Copy link
Copy Markdown
Contributor

Summary

  • When the cashier types a partial item name in the search box and presses Enter, the first visible search result is added to the cart immediately
  • If no search results are present (e.g. typing a barcode), the existing exact barcode lookup runs as before — no regression for scanner workflows
  • Variant/UOM/batch dialogs still appear when needed (respects auto-add mode)

Behaviour change

Before After
Enter → exact barcode lookup → "Item Not Found" for partial text Enter → first search result added to cart
Barcode scan → works as before Barcode scan → works as before (fallback path)

Files changed

  • POS/src/composables/useSearchInput.jshandleKeyDown: checks itemStore.filteredItems[0] before falling back to barcode lookup

Test plan

  • Type a partial item name → results appear → press Enter → first result added to cart
  • Type an exact barcode → press Enter → barcode lookup fires normally
  • Type something with no matches → press Enter → "Item Not Found" warning
  • With auto-add ON: Enter adds without prompts for simple items
  • With auto-add OFF: Enter opens variant/UOM dialog if applicable

🤖 Generated with Claude Code

When the user presses Enter in the item search box and search results
are visible, the first result is added to the cart immediately instead
of falling back to an exact barcode lookup (which showed "Item Not Found"
for partial text). Barcode lookup is preserved as the fallback when
no search results are present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant