Ensure links in chats cannot be opened by accident when closing the channel list

This commit is contained in:
Jérémie Astori 2018-03-17 03:12:30 -04:00
parent 4c0479fe3d
commit cf49a3427e
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8
2 changed files with 8 additions and 7 deletions

View File

@ -518,7 +518,7 @@ kbd {
width: 220px; width: 220px;
} }
#sidebar.menu-open { #viewport.menu-open #sidebar {
display: none; display: none;
will-change: transform; will-change: transform;
} }
@ -2278,16 +2278,16 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */
transform: translateZ(0); transform: translateZ(0);
} }
#sidebar.menu-open { #viewport.menu-open #sidebar {
display: flex; display: flex;
transform: translate3d(220px, 0, 0); transform: translate3d(220px, 0, 0);
} }
#sidebar.menu-dragging { #viewport.menu-dragging #sidebar {
transition: none !important; transition: none !important;
} }
#sidebar.menu-open .messages { #viewport.menu-open .messages {
pointer-events: none; pointer-events: none;
} }

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
const viewport = document.getElementById("viewport");
const menu = document.getElementById("sidebar"); const menu = document.getElementById("sidebar");
let touchStartPos = null; let touchStartPos = null;
@ -16,7 +17,7 @@ class SlideoutMenu {
static toggle(state) { static toggle(state) {
menuIsOpen = state; menuIsOpen = state;
menu.classList.toggle("menu-open", state); viewport.classList.toggle("menu-open", state);
} }
static isOpen() { static isOpen() {
@ -39,7 +40,7 @@ function onTouchStart(e) {
touchCurPos = touch; touchCurPos = touch;
touchStartTime = Date.now(); touchStartTime = Date.now();
menu.classList.toggle("menu-dragging", true); viewport.classList.toggle("menu-dragging", true);
document.body.addEventListener("touchmove", onTouchMove); document.body.addEventListener("touchmove", onTouchMove);
document.body.addEventListener("touchend", onTouchEnd, {passive: true}); document.body.addEventListener("touchend", onTouchEnd, {passive: true});
} }
@ -86,7 +87,7 @@ function onTouchEnd() {
document.body.removeEventListener("touchmove", onTouchMove); document.body.removeEventListener("touchmove", onTouchMove);
document.body.removeEventListener("touchend", onTouchEnd); document.body.removeEventListener("touchend", onTouchEnd);
menu.classList.toggle("menu-dragging", false); viewport.classList.toggle("menu-dragging", false);
menu.style.transform = null; menu.style.transform = null;
touchStartPos = null; touchStartPos = null;