From 61ece14fe710c72ab49b44a079720c56e88dd757 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 26 Dec 2022 05:15:51 -0800 Subject: [PATCH] Add new event handlers to Search --- components/SearchModal/index.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/components/SearchModal/index.tsx b/components/SearchModal/index.tsx index b7cdebb9..6353e51a 100644 --- a/components/SearchModal/index.tsx +++ b/components/SearchModal/index.tsx @@ -340,10 +340,24 @@ const SearchModal = (props: Props) => { } } + function onEscapeKeyDown(event: KeyboardEvent) { + event.preventDefault() + openChange() + } + + function onOpenAutoFocus(event: Event) { + event.preventDefault() + if (searchInput.current) searchInput.current.focus() + } + return ( {props.children} - +