From de2d935d72e9d9157c81d094bc4c060dbcfccd9d Mon Sep 17 00:00:00 2001 From: XLor Date: Thu, 31 Aug 2023 00:59:33 +0800 Subject: [PATCH] fix(app): can not input s and / --- packages/app/src/components/Search.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/app/src/components/Search.tsx b/packages/app/src/components/Search.tsx index cf9f0111..9bcc386e 100644 --- a/packages/app/src/components/Search.tsx +++ b/packages/app/src/components/Search.tsx @@ -16,10 +16,12 @@ const SearchInputKey = 'search:input'; document.addEventListener('keypress', (ev) => { if (ev.key === 's' || ev.key === '/') { const input = document.querySelector('#animegarden-search input'); - // @ts-ignore - input?.focus(); - ev.preventDefault(); - ev.stopPropagation(); + if (document.activeElement !== input) { + // @ts-ignore + input?.focus(); + ev.preventDefault(); + ev.stopPropagation(); + } } });