From d98a6d90b1feb2743556c46b7b3670987a5355cc Mon Sep 17 00:00:00 2001 From: muerwre Date: Tue, 12 Feb 2019 10:16:29 +0700 Subject: [PATCH] fixed key events on inputs --- src/redux/user/actions.js | 2 +- src/redux/user/sagas.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/redux/user/actions.js b/src/redux/user/actions.js index 537b498..acbcf6c 100644 --- a/src/redux/user/actions.js +++ b/src/redux/user/actions.js @@ -51,7 +51,7 @@ export const locationChanged = location => ({ type: ACTIONS.LOCATION_CHANGED, lo export const setReady = ready => ({ type: ACTIONS.SET_READY, ready }); export const gotVkUser = user => ({ type: ACTIONS.GOT_VK_USER, user }); -export const keyPressed = ({ key }) => ({ type: ACTIONS.KEY_PRESSED, key }); +export const keyPressed = ({ key, target: { tagName } }) => ({ type: ACTIONS.KEY_PRESSED, key, target: tagName }); export const searchSetTitle = title => ({ type: ACTIONS.SEARCH_SET_TITLE, title }); export const searchSetDistance = distance => ({ type: ACTIONS.SEARCH_SET_DISTANCE, distance }); diff --git a/src/redux/user/sagas.js b/src/redux/user/sagas.js index a317bb2..82e7514 100644 --- a/src/redux/user/sagas.js +++ b/src/redux/user/sagas.js @@ -431,7 +431,14 @@ function* gotVkUserSaga({ user }) { yield put(setUser(data)); } -function* keyPressedSaga({ key }): void { +function* keyPressedSaga({ key, target }): any { + if ( + target === 'INPUT' || + target === 'TEXTAREA' + ) { + return; + } + if (key === 'Escape') { const { dialog_active, mode, renderer: { renderer_active } } = yield select(getState);