fix automatically closing sidebar on some mobile viewports

Co-authored-by: Pavel Djundik <github@xpaw.me>

Mobile viewports whose width is equal to the upper boundary
of the mobile viewport breakpoint would not automatically
close the sidebar when selecting an item in it.

Closes #2783.
This commit is contained in:
William Boman 2018-09-18 21:27:35 +02:00
parent 2745931e9e
commit 658dc5a3a2
2 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ $(function() {
$("#sidebar-overlay").on("click", () => {
slideoutMenu.toggle(false);
if ($(window).outerWidth() >= utils.mobileViewportPixels) {
if ($(window).outerWidth() > utils.mobileViewportPixels) {
storeSidebarVisibility("thelounge.state.sidebar", false);
}
});
@ -47,7 +47,7 @@ $(function() {
slideoutMenu.toggle(isOpen);
if ($(window).outerWidth() >= utils.mobileViewportPixels) {
if ($(window).outerWidth() > utils.mobileViewportPixels) {
storeSidebarVisibility("thelounge.state.sidebar", isOpen);
}
});
@ -192,7 +192,7 @@ $(function() {
utils.toggleNotificationMarkers(false);
}
if (!keepSidebarOpen && $(window).outerWidth() < utils.mobileViewportPixels) {
if (!keepSidebarOpen && $(window).outerWidth() <= utils.mobileViewportPixels) {
slideoutMenu.toggle(false);
}
}

View File

@ -44,7 +44,7 @@ socket.on("init", function(data) {
const viewportWidth = $(window).outerWidth();
let isUserlistOpen = storage.get("thelounge.state.userlist");
if (viewportWidth >= utils.mobileViewportPixels) {
if (viewportWidth > utils.mobileViewportPixels) {
slideoutMenu.toggle(storage.get("thelounge.state.sidebar") !== "false");
}