mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 13:05:17 +08:00
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:
parent
5cc8d5b17b
commit
c6949a26c5
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue
Block a user