mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 02:35:48 +03:00
Merge pull request #4316 from matrix-org/t3chguy/room-tile-auto-scroll
Only auto-scroll to RoomTile when clicking on RoomTile or via shortcuts
This commit is contained in:
commit
7143c91d16
3 changed files with 4 additions and 2 deletions
|
@ -126,7 +126,7 @@ export default class RoomSubList extends React.PureComponent {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'view_room':
|
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.props.list.some((r) => r.roomId === payload.room_id)
|
||||||
) {
|
) {
|
||||||
this.toggle();
|
this.toggle();
|
||||||
|
@ -193,6 +193,7 @@ export default class RoomSubList extends React.PureComponent {
|
||||||
onRoomTileClick = (roomId, ev) => {
|
onRoomTileClick = (roomId, ev) => {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
|
show_room_tile: true, // to make sure the room gets scrolled into view
|
||||||
room_id: roomId,
|
room_id: roomId,
|
||||||
clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
|
clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -289,6 +289,7 @@ export default createReactClass({
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: room.roomId,
|
room_id: room.roomId,
|
||||||
|
show_room_tile: true, // to make sure the room gets scrolled into view
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -203,7 +203,7 @@ export default createReactClass({
|
||||||
|
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
// when the room is selected make sure its tile is visible, for breadcrumbs/keyboard shortcut access
|
// 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();
|
this._scrollIntoView();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue