From cf49a3427e8b7b3809251fcbb0318297d14d5bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 17 Mar 2018 03:12:30 -0400 Subject: [PATCH] Ensure links in chats cannot be opened by accident when closing the channel list --- client/css/style.css | 8 ++++---- client/js/slideout.js | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 2c7ee5cf..fc3f6053 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -518,7 +518,7 @@ kbd { width: 220px; } -#sidebar.menu-open { +#viewport.menu-open #sidebar { display: none; will-change: transform; } @@ -2278,16 +2278,16 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */ transform: translateZ(0); } - #sidebar.menu-open { + #viewport.menu-open #sidebar { display: flex; transform: translate3d(220px, 0, 0); } - #sidebar.menu-dragging { + #viewport.menu-dragging #sidebar { transition: none !important; } - #sidebar.menu-open .messages { + #viewport.menu-open .messages { pointer-events: none; } diff --git a/client/js/slideout.js b/client/js/slideout.js index 113ff539..c3b64c65 100644 --- a/client/js/slideout.js +++ b/client/js/slideout.js @@ -1,5 +1,6 @@ "use strict"; +const viewport = document.getElementById("viewport"); const menu = document.getElementById("sidebar"); let touchStartPos = null; @@ -16,7 +17,7 @@ class SlideoutMenu { static toggle(state) { menuIsOpen = state; - menu.classList.toggle("menu-open", state); + viewport.classList.toggle("menu-open", state); } static isOpen() { @@ -39,7 +40,7 @@ function onTouchStart(e) { touchCurPos = touch; touchStartTime = Date.now(); - menu.classList.toggle("menu-dragging", true); + viewport.classList.toggle("menu-dragging", true); document.body.addEventListener("touchmove", onTouchMove); document.body.addEventListener("touchend", onTouchEnd, {passive: true}); } @@ -86,7 +87,7 @@ function onTouchEnd() { document.body.removeEventListener("touchmove", onTouchMove); document.body.removeEventListener("touchend", onTouchEnd); - menu.classList.toggle("menu-dragging", false); + viewport.classList.toggle("menu-dragging", false); menu.style.transform = null; touchStartPos = null;