Skip to content

Commit

Permalink
fix: improve form submission and button types in search components + …
Browse files Browse the repository at this point in the history
…fix e2e test
  • Loading branch information
alexmarqs committed Feb 15, 2025
1 parent 4d85acd commit 797e850
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/web/src/components/FiltersPanelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default function FiltersPanelButton({
extendedUI={() => (
<>
<Button
type="submit"
variant="secondary"
className="w-full"
onClick={() => {
Expand Down
9 changes: 8 additions & 1 deletion apps/web/src/components/SearchSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ export function SearchSideBar({
variant="static"
className="shrink-0 md:w-[290px] md:mx-auto"
>
<form className="px-4 py-3 w-full" aria-label="Search form">
<form
className="px-4 py-3 w-full"
aria-label="Search form"
onSubmit={(e) => {
e.preventDefault();
}}
>
<fieldset className="mt-2">
<legend className="sr-only">Search Filters</legend>
<div className="space-y-4">
Expand Down Expand Up @@ -107,6 +113,7 @@ export function SearchSideBar({
</div>

<Button
type="button"
variant="outline"
disabled={appliedFilters.length === 0}
className="h-9 w-full px-2 border-destructive text-destructive hover:bg-destructive/10 hover:text-destructive"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/tests/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe("Homepage e2e tests", () => {
page.getByRole("combobox", { name: "Category" }),
).toBeVisible();
await expect(
page.getByRole("textbox", { name: "Search term" }),
page.getByRole("textbox", { name: "Search by name or description" }),
).toBeVisible();
await expect(
page.getByRole("combobox", { name: "Location" }),
Expand Down

0 comments on commit 797e850

Please sign in to comment.