mirror of https://github.com/vector-im/riot-web
Scroll breadcrumbs to the left when they change
Fixes https://github.com/vector-im/riot-web/issues/9355pull/21833/head
parent
37afa9fc0e
commit
04b521c48b
|
@ -40,6 +40,13 @@ export default class IndicatorScrollbar extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moveToOrigin() {
|
||||||
|
if (!this._scrollElement) return;
|
||||||
|
|
||||||
|
this._scrollElement.scrollLeft = 0;
|
||||||
|
this._scrollElement.scrollTop = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_collectScroller(scroller) {
|
_collectScroller(scroller) {
|
||||||
if (scroller && !this._scrollElement) {
|
if (scroller && !this._scrollElement) {
|
||||||
this._scrollElement = scroller;
|
this._scrollElement = scroller;
|
||||||
|
|
|
@ -173,6 +173,10 @@ export default class RoomBreadcrumbs extends React.Component {
|
||||||
rooms.splice(MAX_ROOMS, rooms.length - MAX_ROOMS);
|
rooms.splice(MAX_ROOMS, rooms.length - MAX_ROOMS);
|
||||||
}
|
}
|
||||||
this.setState({rooms});
|
this.setState({rooms});
|
||||||
|
|
||||||
|
if (this.refs.scroller) {
|
||||||
|
this.refs.scroller.moveToOrigin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_viewRoom(room) {
|
_viewRoom(room) {
|
||||||
|
|
Loading…
Reference in New Issue