Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/web/src/components/search/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,7 @@ const SearchBox = (props) => {
listenForFocusShortcuts();
}, []);

const hasSuggestions = () =>
(Array.isArray(props.defaultSuggestions) && props.defaultSuggestions.length)
|| (Array.isArray(parsedSuggestions()) && parsedSuggestions().length);
const hasSuggestions = () => (Array.isArray(parsedSuggestions()) && parsedSuggestions().length);

return (
<Container style={props.style} className={props.className}>
Expand All @@ -840,7 +838,7 @@ const SearchBox = (props) => {
{props.title}
</Title>
)}
{hasSuggestions() || props.autosuggest ? (
{hasSuggestions() && props.autosuggest ? (
<Downshift
id={`${props.componentId}-downshift`}
onChange={onSuggestionSelected}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,16 @@ exports[`should display/ hide (search/ clear )icon when (showIcon/ showClear )pr
className="emotion-7 emotion-8"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-9 emotion-10"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-9 emotion-10"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value="test"
/>
<div>
Expand Down Expand Up @@ -1206,24 +1198,16 @@ exports[`should render (prefixed/ suffixed) UI nodes with searchbox when (addonB
className="emotion-9 emotion-10"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-11 emotion-12"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-11 emotion-12"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value=""
/>
<div>
Expand Down Expand Up @@ -1440,24 +1424,16 @@ exports[`should render SearchBox 1`] = `
className="emotion-7 emotion-8"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-9 emotion-10"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-9 emotion-10"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value=""
/>
<div>
Expand Down Expand Up @@ -1678,24 +1654,16 @@ exports[`should render SearchBox with title 1`] = `
className="emotion-9 emotion-10"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-11 emotion-12"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-11 emotion-12"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value=""
/>
<div>
Expand Down Expand Up @@ -3379,24 +3347,16 @@ exports[`should render search icon on the right 1`] = `
className="emotion-7 emotion-8"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={true}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-9 emotion-10"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-9 emotion-10"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value=""
/>
<div>
Expand Down Expand Up @@ -3605,24 +3565,16 @@ exports[`should render with a default value when defaultValue prop is set 1`] =
className="emotion-7 emotion-8"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-9 emotion-10"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-9 emotion-10"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value="test"
/>
<div>
Expand Down Expand Up @@ -3830,24 +3782,16 @@ exports[`should show voice search when showVoiceSearch prop is set 1`] = `
className="emotion-7 emotion-8"
>
<input
aria-activedescendant={null}
aria-autocomplete="list"
aria-expanded={false}
aria-label="MockSearchBox"
autoComplete="off"
autoFocus={undefined}
className=" emotion-9 emotion-10"
id="MockSearchBox-downshift-input"
onBlur={[Function]}
className="emotion-9 emotion-10"
onBlur={undefined}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onFocus={undefined}
onKeyDown={undefined}
onKeyPress={undefined}
onKeyUp={undefined}
placeholder="Search"
role="combobox"
type={undefined}
value=""
/>
<div>
Expand Down