Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
docs(search): add comments explaining SearchBox.Input.onKeyDown
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Sep 2, 2021
1 parent 80e9abf commit b92f157
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/src/components/SearchBox/SearchBox.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,14 @@ const SearchBox = ({
// when selecting option using keyboard
// downshift prevents form submission which is used to submit analytics event
// detect such event and separately send analytics event

if (highlightedIndex === null && searchOnEnter) {
// if the user has typed in search and hit enter,
// without selecting any of the SearchItems
sendSearchEventToAnalytics(inputValue)
handleSubmit(inputValue)
} else if (highlightedIndex !== null) {
// otherwise, if the user has selected a specific SearchItem
sendSearchEventToAnalytics(inputValue)
}
}
Expand Down

0 comments on commit b92f157

Please sign in to comment.