Disable scrolling while the user / room list overlay is open

This commit is contained in:
Maximilian Mader 2022-08-09 23:59:55 +02:00
parent f85699b314
commit 8e2bb52fc6
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
2 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,7 @@ define([
return
}
this.mobile = false
this.open = false
this.sidebar = document.querySelector('.sidebar')
@ -48,6 +49,7 @@ define([
}
enableMobile() {
this.mobile = true
this.element.parentElement.hidden = false
}
@ -57,6 +59,7 @@ define([
}
this.element.parentElement.hidden = true
this.mobile = false
}
show(doShow = true) {
@ -75,6 +78,10 @@ define([
this.roomList.appendChild(this.closeButton)
this.roomList.dataset.show = 'true'
if (this.mobile) {
UiScreen.scrollDisable()
}
}
else {
delete this.roomList.dataset.show
@ -86,6 +93,10 @@ define([
this.sidebar.style.removeProperty('display')
this.open = false
if (this.mobile) {
UiScreen.scrollEnable()
}
}
}

View File

@ -31,6 +31,7 @@ define([
constructor(element, ...superDeps) {
super(element, ...superDeps)
this.mobile = false
this.open = false
this.userList = document.getElementById('chatUserList')
this.sidebar = document.querySelector('.sidebar')
@ -43,6 +44,7 @@ define([
}
enableMobile() {
this.mobile = true
this.element.parentElement.hidden = false
}
@ -52,6 +54,7 @@ define([
}
this.element.parentElement.hidden = true
this.mobile = false
}
show(doShow = true) {
@ -70,6 +73,10 @@ define([
this.userList.appendChild(this.closeButton)
this.userList.dataset.show = 'true'
if (this.mobile) {
UiScreen.scrollDisable()
}
}
else {
delete this.userList.dataset.show
@ -81,6 +88,10 @@ define([
this.sidebar.style.removeProperty('display')
this.open = false
if (this.mobile) {
UiScreen.scrollEnable()
}
}
}