From 9c63be7dc445de9eeebde7e3c9844987807a624c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 23 Oct 2019 18:31:00 +0100 Subject: [PATCH] Remove wrapping div around RoomList to fix regression with scrollbars Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LeftPanel.js | 38 ++++++++++++++++++-------- src/components/structures/SearchBox.js | 2 ++ src/components/views/rooms/RoomList.js | 12 ++++++-- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index 8a21b017fd..f5687f0595 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -116,6 +116,20 @@ const LeftPanel = createReactClass({ this.focusedElement = null; }, + _onFilterKeyDown: function(ev) { + if (!this.focusedElement) return; + + switch (ev.key) { + case Key.ENTER: { + const firstRoom = ev.target.closest(".mx_LeftPanel").querySelector(".mx_RoomTile"); + if (firstRoom) { + firstRoom.click(); + } + break; + } + } + }, + _onKeyDown: function(ev) { if (!this.focusedElement) return; @@ -255,6 +269,7 @@ const LeftPanel = createReactClass({ enableRoomSearchFocus={true} blurredPlaceholder={ _t('Filter') } placeholder={ _t('Filter rooms…') } + onKeyDown={this._onFilterKeyDown} onSearch={ this.onSearch } onCleared={ this.onSearchCleared } onFocus={this._onSearchFocus} @@ -273,18 +288,19 @@ const LeftPanel = createReactClass({ { breadcrumbs } -
-
- { exploreButton } - { searchBox } -
- +
+ { exploreButton } + { searchBox }
+
); diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index de9a86c3a6..21613733db 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -30,6 +30,7 @@ module.exports = createReactClass({ propTypes: { onSearch: PropTypes.func, onCleared: PropTypes.func, + onKeyDown: PropTypes.func, className: PropTypes.string, placeholder: PropTypes.string.isRequired, @@ -93,6 +94,7 @@ module.exports = createReactClass({ this._clearSearch("keyboard"); break; } + if (this.props.onKeyDown) this.props.onKeyDown(ev); }, _onFocus: function(ev) { diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 036f50d899..80a03e7a73 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -770,9 +770,17 @@ module.exports = createReactClass({ const subListComponents = this._mapSubListProps(subLists); + const {resizeNotifier, collapsed, searchFilter, ConferenceHandler, ...props} = this.props; // eslint-disable-line return ( -
+
{ subListComponents }
);