Catch pageup/down and ctrl-home/end at the top level

Make the scroll keys work when the focus is outside the message panel.
This commit is contained in:
Richard van der Hoff 2016-04-05 13:14:11 +01:00
parent c5c9cad0cb
commit 8b8ee21765
7 changed files with 189 additions and 23 deletions

View file

@ -1115,6 +1115,24 @@ module.exports = React.createClass({
}
},
/**
* called by the parent component when PageUp/Down/etc is pressed.
*
* We pass it down to the scroll panel.
*/
handleScrollKey: function(ev) {
var panel;
if(this.refs.searchResultsPanel) {
panel = this.refs.searchResultsPanel;
} else if(this.refs.messagePanel) {
panel = this.refs.messagePanel;
}
if(panel) {
panel.handleScrollKey(ev);
}
},
// this has to be a proper method rather than an unnamed function,
// otherwise react calls it with null on each update.
_gatherTimelinePanelRef: function(r) {