diff --git a/src/controllers/molecules/MessageComposer.js b/src/controllers/molecules/MessageComposer.js index 74e47fcd..3bd0f7f8 100644 --- a/src/controllers/molecules/MessageComposer.js +++ b/src/controllers/molecules/MessageComposer.js @@ -182,12 +182,12 @@ module.exports = { var self = this; setTimeout(function() { - if (self.refs.textarea.getDOMNode().value != '') { + if (self.refs.textarea && self.refs.textarea.getDOMNode().value != '') { self.onTypingActivity(); } else { self.onFinishedTyping(); } - }, 10); + }, 10); // XXX: what is this 10ms setTimeout doing? Looks hacky :( }, onEnter: function(ev) { diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 71c9140c..7c32a66d 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -166,7 +166,8 @@ module.exports = { break; } } - roomIndex = Math.max((roomIndex + roomIndexDelta) % allRooms.length, 0); + roomIndex = (roomIndex + roomIndexDelta) % allRooms.length; + if (roomIndex < 0) roomIndex = allRooms.length - 1; this.focusComposer = true; this.setState({ currentRoom: allRooms[roomIndex].roomId @@ -250,10 +251,12 @@ module.exports = { case 38: dis.dispatch({action: 'view_prev_room'}); ev.stopPropagation(); + ev.preventDefault(); break; case 40: dis.dispatch({action: 'view_next_room'}); ev.stopPropagation(); + ev.preventDefault(); break; } }