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 @action
storeScrollPosition() { storeScrollPosition() {
const scroller = document.querySelector(".channels-list"); const scrollTop = document.querySelector(".channels-list")?.scrollTop || 0;
if (scroller) { this.session.channelsListPosition = scrollTop;
const scrollTop = scroller.scrollTop || 0;
this.session.set("channels-list-position", scrollTop);
}
} }
@bind @bind
_applyScrollPosition() { _applyScrollPosition() {
const data = this.session.get("channels-list-position"); const position = this.chatStateManager.isFullPage
if (data) { ? this.session.channelsListPosition || 0
const scroller = document.querySelector(".channels-list"); : 0;
scroller.scrollTo(0, data); const scroller = document.querySelector(".channels-list");
} scroller.scrollTo(0, position);
} }
} }

View File

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