FIX: only applies scroll position to full page (#19011)

No tests as:
- scroll position is not always supe reliable
- this should all be replaced by sidebar and is not supposed to change much
This commit is contained in:
Joffrey JAFFEUX 2022-11-14 13:21:27 +01:00 committed by GitHub
parent 5cc8d5b17b
commit c6949a26c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View File

@ -92,19 +92,16 @@ export default class ChannelsList extends Component {
@action
storeScrollPosition() {
const scroller = document.querySelector(".channels-list");
if (scroller) {
const scrollTop = scroller.scrollTop || 0;
this.session.set("channels-list-position", scrollTop);
}
const scrollTop = document.querySelector(".channels-list")?.scrollTop || 0;
this.session.channelsListPosition = scrollTop;
}
@bind
_applyScrollPosition() {
const data = this.session.get("channels-list-position");
if (data) {
const scroller = document.querySelector(".channels-list");
scroller.scrollTo(0, data);
}
const position = this.chatStateManager.isFullPage
? this.session.channelsListPosition || 0
: 0;
const scroller = document.querySelector(".channels-list");
scroller.scrollTo(0, position);
}
}

View File

@ -8,7 +8,7 @@
role="region"
aria-label={{i18n "chat.aria_roles.channels_list"}}
class="channels-list"
{{on "scroll" (action "storeScrollPosition")}}
{{on "scroll" (if this.chatStateManager.isFullPage this.storeScrollPosition (noop))}}
>
{{#if this.displayPublicChannels}}
<div class="chat-channel-divider public-channels-section">