mirror of
https://github.com/discourse/discourse.git
synced 2025-02-28 09:24:09 +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
|
@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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user