From c03f145f04f32beeed56ed72520bc7d1e0e74529 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Tue, 6 Sep 2016 17:00:28 +0100 Subject: [PATCH] Basic keyboard scrolling of queryList --- src/components/views/dialogs/ChatInviteDialog.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index 6c8569055a..56ad0ad6f2 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -68,6 +68,12 @@ module.exports = React.createClass({ this._updateUserList(); }, + componentDidUpdate: function() { + // As the user scrolls with the arrow keys keep the selected item + // at the top of the window. Each item is 29px high. + this.scrollElement.scrollTop = this.state.selected * 29; + }, + onStartChat: function() { if (this.state.user) { this._startChat(this.state.user.userId); @@ -251,7 +257,7 @@ module.exports = React.createClass({ var queryListElements = this.createQueryListTiles(); if (queryListElements.length > 0) { queryList = ( -
+
{this.scrollElement = ref}}> { queryListElements }
);