diff --git a/src/components/FieldCatalog.tsx b/src/components/FieldCatalog.tsx index d6d08e389b9bc5f..442cb26c10736a2 100644 --- a/src/components/FieldCatalog.tsx +++ b/src/components/FieldCatalog.tsx @@ -1,4 +1,9 @@ -import { useEffect, useState, type ChangeEvent } from "react"; +import { + useEffect, + useState, + type ChangeEvent, + type KeyboardEvent, +} from "react"; import FieldBadges from "./fields/FieldBadges"; import Markdown from "react-markdown"; import type { CollectionEntry } from "astro:content"; @@ -95,6 +100,11 @@ const FieldCatalog = ({ fields }: { fields: Fields }) => { placeholder="Search fields" value={filters.search} onChange={(e) => setFilters({ ...filters, search: e.target.value })} + onKeyDown={(e: KeyboardEvent) => { + if (e.key === "Escape") { + setFilters({ ...filters, search: "" }); + } + }} />