From dac075c61a33eafa6778d04b9f972dbc1e1dfb57 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Tue, 21 Jul 2020 14:53:01 +0300 Subject: [PATCH 1/4] Fix mobile setting modal behavior: ensure the mobile browser address bar doesn't overlap the modal top panel. --- src/App.scss | 16 ++++++++++++++++ src/components/settings_modal/settings_modal.js | 15 +++++++++++++++ .../settings_modal/settings_modal.scss | 3 ++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/App.scss b/src/App.scss index e2e2d079..21c00bac 100644 --- a/src/App.scss +++ b/src/App.scss @@ -943,6 +943,22 @@ nav { line-height: 1.3rem; } +.settings-modal-layout { + @media all and (max-width: 800px) { + height: 100%; + + body { + height: 100vh; + overflow-y: hidden; + position: fixed; + } + + #app { + height: 100%; + } + } +} + .chat-layout { // Needed for smoother chat navigation in the desktop Safari (otherwise the chat layout "jumps" as the chat opens). overflow: hidden; diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index f0d49c91..b6880445 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -36,6 +36,21 @@ const SettingsModal = { modalPeeked () { return this.$store.state.interface.settingsModalState === 'minimized' } + }, + watch: { + modalActivated (newValue) { + if (newValue) { + let html = document.querySelector('html') + if (html) { + html.classList.add('settings-modal-layout') + } + } else { + let html = document.querySelector('html') + if (html) { + html.classList.remove('settings-modal-layout') + } + } + } } } diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss index 0da4d9a8..e7f4d3d3 100644 --- a/src/components/settings_modal/settings_modal.scss +++ b/src/components/settings_modal/settings_modal.scss @@ -1,6 +1,7 @@ @import 'src/_variables.scss'; .settings-modal { overflow: hidden; + height: 100%; &.peek { .settings-modal-panel { @@ -27,7 +28,7 @@ @media all and (max-width: 800px) { max-width: 100vw; - height: 100vh; + height: 100%; } >.panel-body { From 61dd1a3b4935d0466bfd77e026c19461d62b124f Mon Sep 17 00:00:00 2001 From: eugenijm Date: Thu, 23 Jul 2020 09:06:50 +0300 Subject: [PATCH 2/4] Add body 100% width for the preview, refactor the modalActivated watcher, use body scroll lock for the setting tab content --- src/App.scss | 1 + src/components/settings_modal/settings_modal.js | 13 +++++-------- src/components/settings_modal/settings_modal.scss | 4 ++++ src/components/tab_switcher/tab_switcher.js | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/App.scss b/src/App.scss index 21c00bac..336c4998 100644 --- a/src/App.scss +++ b/src/App.scss @@ -949,6 +949,7 @@ nav { body { height: 100vh; + width: 100%; overflow-y: hidden; position: fixed; } diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index b6880445..4f54d6a3 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -38,17 +38,14 @@ const SettingsModal = { } }, watch: { + // This is the only way to access the element. modalActivated (newValue) { + let html = document.querySelector('html') + if (!html) return if (newValue) { - let html = document.querySelector('html') - if (html) { - html.classList.add('settings-modal-layout') - } + html.classList.add('settings-modal-layout') } else { - let html = document.querySelector('html') - if (html) { - html.classList.remove('settings-modal-layout') - } + html.classList.remove('settings-modal-layout') } } } diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss index e7f4d3d3..f32db4bd 100644 --- a/src/components/settings_modal/settings_modal.scss +++ b/src/components/settings_modal/settings_modal.scss @@ -14,6 +14,10 @@ * - 50px - leaving tiny amount of space so that titlebar + tiny amount of modal is visible */ transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 50px)); + + @media all and (max-width: 800px) { + transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 100px)); + } } } diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 7891cb78..919eb7cd 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -134,7 +134,7 @@ export default Vue.component('tab-switcher', {
{tabs}
-
+
{contents}
From 2298ad0011e8507a138d967ed142641981e1e297 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Thu, 23 Jul 2020 09:41:22 +0300 Subject: [PATCH 3/4] Use bock-scroll-lock directive for the settings modal --- src/App.scss | 17 ----------------- src/components/settings_modal/settings_modal.js | 12 ------------ .../settings_modal/settings_modal.scss | 3 +-- src/components/tab_switcher/tab_switcher.js | 11 +++++++++-- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/App.scss b/src/App.scss index 336c4998..e2e2d079 100644 --- a/src/App.scss +++ b/src/App.scss @@ -943,23 +943,6 @@ nav { line-height: 1.3rem; } -.settings-modal-layout { - @media all and (max-width: 800px) { - height: 100%; - - body { - height: 100vh; - width: 100%; - overflow-y: hidden; - position: fixed; - } - - #app { - height: 100%; - } - } -} - .chat-layout { // Needed for smoother chat navigation in the desktop Safari (otherwise the chat layout "jumps" as the chat opens). overflow: hidden; diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 4f54d6a3..f0d49c91 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -36,18 +36,6 @@ const SettingsModal = { modalPeeked () { return this.$store.state.interface.settingsModalState === 'minimized' } - }, - watch: { - // This is the only way to access the element. - modalActivated (newValue) { - let html = document.querySelector('html') - if (!html) return - if (newValue) { - html.classList.add('settings-modal-layout') - } else { - html.classList.remove('settings-modal-layout') - } - } } } diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss index f32db4bd..cdb32fd7 100644 --- a/src/components/settings_modal/settings_modal.scss +++ b/src/components/settings_modal/settings_modal.scss @@ -1,7 +1,6 @@ @import 'src/_variables.scss'; .settings-modal { overflow: hidden; - height: 100%; &.peek { .settings-modal-panel { @@ -16,7 +15,7 @@ transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 50px)); @media all and (max-width: 800px) { - transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 100px)); + transform: translateY(calc(100% - 50px)); } } } diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 919eb7cd..19206610 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -1,4 +1,5 @@ import Vue from 'vue' +import { mapState } from 'vuex' import './tab_switcher.scss' @@ -44,7 +45,13 @@ export default Vue.component('tab-switcher', { } else { return this.active } - } + }, + bodyLocked () { + return this.settingsModalState === 'visible' + }, + ...mapState({ + settingsModalState: state => state.interface.settingsModalState + }) }, beforeUpdate () { const currentSlot = this.$slots.default[this.active] @@ -134,7 +141,7 @@ export default Vue.component('tab-switcher', {
{tabs}
-
+
{contents}
From 77d65d6cecfae1bdbf5e5b7d8c882d39846b91f1 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Thu, 23 Jul 2020 12:20:48 +0300 Subject: [PATCH 4/4] Ensures the minimized modal is always 50px above the mobile browser bottom bar regardless of whether or not it is visible. --- src/components/settings_modal/settings_modal.scss | 3 +++ src/components/tab_switcher/tab_switcher.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss index cdb32fd7..90446b36 100644 --- a/src/components/settings_modal/settings_modal.scss +++ b/src/components/settings_modal/settings_modal.scss @@ -15,6 +15,9 @@ transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 50px)); @media all and (max-width: 800px) { + /* For mobile, the modal takes 100% of the available screen. + This ensures the minimized modal is always 50px above the browser bottom bar regardless of whether or not it is visible. + */ transform: translateY(calc(100% - 50px)); } } diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 19206610..40b5b3ca 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -46,7 +46,7 @@ export default Vue.component('tab-switcher', { return this.active } }, - bodyLocked () { + settingsModalVisible () { return this.settingsModalState === 'visible' }, ...mapState({ @@ -141,7 +141,7 @@ export default Vue.component('tab-switcher', {
{tabs}
-
+
{contents}