Skip to content

Commit

Permalink
Enable adding a custom browser search engine from the filter input
Browse files Browse the repository at this point in the history
  • Loading branch information
darekkay committed Jan 13, 2022
1 parent 1a212f5 commit 44883f7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/filter/Filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ const Filter = ({ currentValue, applyFilter }) => {
};

return (
<div className="filter" role="search">
// using a form to enable adding a custom browser search engine from the filter input
<form
className="filter"
role="search"
// prevent site reloads
onSubmit={(event) => event.preventDefault()}
>
<div className={cn("filter-button", { empty: !currentValue })}>
<Button
label="Clear filter"
Expand All @@ -48,14 +54,15 @@ const Filter = ({ currentValue, applyFilter }) => {
</div>
<input
ref={(input) => input && input.focus()}
name="search"
className="input"
value={currentValue}
placeholder="Search everywhere..."
aria-label="Search everywhere"
onChange={handleChange}
type="search"
/>
</div>
</form>
);
};

Expand Down

0 comments on commit 44883f7

Please sign in to comment.