TRA-4169 apply query by enter (#733)

This commit is contained in:
leon-up9 2022-01-31 17:08:03 +02:00 committed by GitHub
parent cbff1837c1
commit fdf552a9ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,11 @@ const useKeyPress = (eventConfigs, callback, node = null) => {
// handle what happens on key press
const handleKeyPress = useCallback(
(event) => {
// check if one of the key is part of the ones we want
if (eventConfigs.some((eventConfig) => Object.keys(eventConfig).every(nameKey => eventConfig[nameKey] === event[nameKey]))) {
event.stopPropagation()
event.preventDefault();
callbackRef.current(event);
}
},