From 8bc54ae2058321fae6a0f3b5e392c1fb63add892 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 1 Apr 2020 10:08:26 +0100 Subject: [PATCH] Only auto-scroll to RoomTile when clicking on RoomTile or via shortcuts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomSubList.js | 3 ++- src/components/views/rooms/RoomList.js | 1 + src/components/views/rooms/RoomTile.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 9428de3e22..2ae2d71100 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -126,7 +126,7 @@ export default class RoomSubList extends React.PureComponent { break; case 'view_room': - if (this.state.hidden && !this.props.forceExpand && + if (this.state.hidden && !this.props.forceExpand && payload.show_room_tile && this.props.list.some((r) => r.roomId === payload.room_id) ) { this.toggle(); @@ -193,6 +193,7 @@ export default class RoomSubList extends React.PureComponent { onRoomTileClick = (roomId, ev) => { dis.dispatch({ action: 'view_room', + show_room_tile: true, // to make sure the room gets scrolled into view room_id: roomId, clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)), }); diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 87299281ff..41482eaa5f 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -289,6 +289,7 @@ export default createReactClass({ dis.dispatch({ action: 'view_room', room_id: room.roomId, + show_room_tile: true, // to make sure the room gets scrolled into view }); } break; diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 0c913b32da..c4c83b69a7 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -203,7 +203,7 @@ export default createReactClass({ case 'view_room': // when the room is selected make sure its tile is visible, for breadcrumbs/keyboard shortcut access - if (payload.room_id === this.props.room.roomId) { + if (payload.room_id === this.props.room.roomId && payload.show_room_tile) { this._scrollIntoView(); } break;