From 61aa19d545b44391f32609e7319fef33b280ddab Mon Sep 17 00:00:00 2001 From: Pratham Vaidya Date: Sun, 31 Mar 2024 23:43:54 +0530 Subject: [PATCH] refactor: used key over keyCode, removed index as key --- .../components/article_finder/article_finder_search_bar.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/components/article_finder/article_finder_search_bar.jsx b/app/assets/javascripts/components/article_finder/article_finder_search_bar.jsx index e263fba4a8..1840b484c5 100644 --- a/app/assets/javascripts/components/article_finder/article_finder_search_bar.jsx +++ b/app/assets/javascripts/components/article_finder/article_finder_search_bar.jsx @@ -40,7 +40,7 @@ function ArticleFinderSearchBar({ value, onChange, onSearch, disabled, wiki }) { const onKeyDownHandler = (e) => { // Search on Enter - if (e.keyCode === 13) { + if (e.key === 'Enter') { searchHandler(); } }; @@ -72,8 +72,8 @@ function ArticleFinderSearchBar({ value, onChange, onSearch, disabled, wiki }) {
{ - suggestions.map((sug, index) => { - return
autoCompleteClickHandler(sug)}> {sug}
; + suggestions.map((sug) => { + return
autoCompleteClickHandler(sug)}> {sug}
; }) }