Make hotkey more seamless (#579)

This commit is contained in:
Tan Nhu 2023-09-20 16:53:03 +00:00 committed by Harness
parent 4f21c1b096
commit dd37e1027a
2 changed files with 10 additions and 2 deletions

View File

@ -56,7 +56,7 @@ export const SearchInputWithSpinner: React.FC<SearchInputWithSpinnerProps> = ({
placeholder={placeholder || getString('search')}
leftIcon={icon as IconName}
style={{ width, height }}
autoFocus
autoFocus={!readOnly && !disabled}
onFocus={event => event.target.select()}
onInput={event => {
setQuery(event.currentTarget.value || '')

View File

@ -63,7 +63,15 @@ export function ContentHeader({
}
}, [performSearch, search, searchSampleQueryIndex])
useHotkeys('ctrl+k', () => setShowSearchModal(true))
useHotkeys(
'ctrl+k',
() => {
if (!showSearchModal) {
setShowSearchModal(true)
}
},
[showSearchModal]
)
const permPushResult = hooks?.usePermissionTranslate?.(
{