From 013ef07f720bd79a9b8a49ae617dd35409e38a10 Mon Sep 17 00:00:00 2001 From: Rodrigo Bacelli Date: Mon, 20 Jul 2015 14:31:30 -0300 Subject: [PATCH] Changes the keypress events to keydown events. Added preventDefault to stop default Browsers actions on 'ctrl + h' --- src/react/LogMonitor.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/react/LogMonitor.js b/src/react/LogMonitor.js index 57ac1054..c1ace4f1 100644 --- a/src/react/LogMonitor.js +++ b/src/react/LogMonitor.js @@ -3,7 +3,7 @@ import LogMonitorEntry from './LogMonitorEntry'; export default class LogMonitor { constructor() { - window.addEventListener('keypress', ::this.handleKeyPress); + window.addEventListener('keydown', ::this.handleKeyPress); } static propTypes = { @@ -76,7 +76,8 @@ export default class LogMonitor { handleKeyPress(event) { let { isVisible } = this.props.monitorState; - if (event.ctrlKey && event.keyCode === 8) { + if (event.ctrlKey && event.keyCode === 72) { + event.preventDefault(); if (isVisible) { this.props.hide(); } else {