Changes the keypress events to keydown events. Added preventDefault to stop default Browsers actions on 'ctrl + h'

This commit is contained in:
Rodrigo Bacelli 2015-07-20 14:31:30 -03:00
parent 86771b647e
commit 013ef07f72

View File

@ -3,7 +3,7 @@ import LogMonitorEntry from './LogMonitorEntry';
export default class LogMonitor { export default class LogMonitor {
constructor() { constructor() {
window.addEventListener('keypress', ::this.handleKeyPress); window.addEventListener('keydown', ::this.handleKeyPress);
} }
static propTypes = { static propTypes = {
@ -76,7 +76,8 @@ export default class LogMonitor {
handleKeyPress(event) { handleKeyPress(event) {
let { isVisible } = this.props.monitorState; let { isVisible } = this.props.monitorState;
if (event.ctrlKey && event.keyCode === 8) { if (event.ctrlKey && event.keyCode === 72) {
event.preventDefault();
if (isVisible) { if (isVisible) {
this.props.hide(); this.props.hide();
} else { } else {