diff --git a/ui/src/hooks/useKeyPress.ts b/ui/src/hooks/useKeyPress.ts index 4f14fd2c7..caf864eb3 100644 --- a/ui/src/hooks/useKeyPress.ts +++ b/ui/src/hooks/useKeyPress.ts @@ -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); } },