fix(giphy) Allow space in input (#12221)

Fixes: space closes gif menu
This commit is contained in:
Robert Pintilii 2022-09-22 11:34:46 +03:00 committed by GitHub
parent e38f9a293b
commit 62a10e6587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -177,6 +177,10 @@ function GifsMenu() {
// This fixes that. // This fixes that.
useEffect(() => setSearchKey(''), []); useEffect(() => setSearchKey(''), []);
const onInputKeyPress = useCallback((e: React.KeyboardEvent) => {
e.stopPropagation();
}, []);
const gifMenu = ( const gifMenu = (
<div <div
className = { cx(styles.gifsMenu, className = { cx(styles.gifsMenu,
@ -186,6 +190,7 @@ function GifsMenu() {
autoFocus = { true } autoFocus = { true }
className = { cx(styles.searchField, 'gif-input') } className = { cx(styles.searchField, 'gif-input') }
onChange = { handleSearchKeyChange } onChange = { handleSearchKeyChange }
onKeyPress = { onInputKeyPress }
placeholder = { t('giphy.search') } placeholder = { t('giphy.search') }
// eslint-disable-next-line react/jsx-no-bind // eslint-disable-next-line react/jsx-no-bind
ref = { inputElement => { ref = { inputElement => {