From 66c6d40353b19f8148a9b24b5449158f9f6b747b Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Fri, 16 Jun 2023 15:06:39 +0100 Subject: [PATCH 1/2] #1471 Implement recent searches using browser `autocomplete` --- .../src/search/searchButton.component.tsx | 1 + .../src/search/searchTextBox.component.tsx | 1 + .../src/searchBoxContainer.component.tsx | 54 ++++++++++--------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/packages/datagateway-search/src/search/searchButton.component.tsx b/packages/datagateway-search/src/search/searchButton.component.tsx index 8f5cd502d..783e66da1 100644 --- a/packages/datagateway-search/src/search/searchButton.component.tsx +++ b/packages/datagateway-search/src/search/searchButton.component.tsx @@ -26,6 +26,7 @@ const SearchButton = (props: SearchButtonCombinedProps): React.ReactElement => { aria-label={t('searchBox.search_button_arialabel')} size="large" fullWidth={true} + type="submit" > {t('searchBox.search_button')} diff --git a/packages/datagateway-search/src/search/searchTextBox.component.tsx b/packages/datagateway-search/src/search/searchTextBox.component.tsx index 531da37af..051a69d5d 100644 --- a/packages/datagateway-search/src/search/searchTextBox.component.tsx +++ b/packages/datagateway-search/src/search/searchTextBox.component.tsx @@ -25,6 +25,7 @@ const SearchTextBox = (props: SearchTextProps): React.ReactElement => { - { + event.preventDefault(); + }} > - - - + + + + - - - + + + - - - + + + - - + + + - +
Date: Wed, 21 Jun 2023 09:37:39 +0100 Subject: [PATCH 2/2] #1471 Fix snapshots --- .../__snapshots__/searchBoxContainer.component.test.tsx.snap | 3 ++- .../search/__snapshots__/searchButton.component.test.tsx.snap | 2 +- .../search/__snapshots__/searchTextBox.component.test.tsx.snap | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/datagateway-search/src/__snapshots__/searchBoxContainer.component.test.tsx.snap b/packages/datagateway-search/src/__snapshots__/searchBoxContainer.component.test.tsx.snap index b0abedbf8..a01a2de97 100644 --- a/packages/datagateway-search/src/__snapshots__/searchBoxContainer.component.test.tsx.snap +++ b/packages/datagateway-search/src/__snapshots__/searchBoxContainer.component.test.tsx.snap @@ -32,6 +32,7 @@ exports[`SearchBoxContainerSide - Tests renders searchBoxContainerSide correctly aria-label="searchBox.search_text_arialabel" class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputTypeSearch css-1g24dm6-MuiInputBase-input-MuiOutlinedInput-input" id="filled-search" + name="dgSearchTextField" type="search" value="" /> @@ -245,7 +246,7 @@ exports[`SearchBoxContainerSide - Tests renders searchBoxContainerSide correctly aria-label="searchBox.search_button_arialabel" class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-fullWidth MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeLarge MuiButton-containedSizeLarge MuiButton-fullWidth css-189e9pj-MuiButtonBase-root-MuiButton-root" tabindex="0" - type="button" + type="submit" > searchBox.search_button searchBox.search_button