From 872db65fd86aaa605789383e629321e32447a997 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 22 Jun 2022 00:30:10 +0300 Subject: [PATCH] slight z-index refactor and attempt at organizing it --- src/App.scss | 9 ++++++++- src/boot/after_store.js | 3 +++ src/components/desktop_nav/desktop_nav.scss | 1 + src/components/emoji_picker/emoji_picker.scss | 3 ++- .../global_notice_list/global_notice_list.vue | 2 +- src/components/media_modal/media_modal.vue | 2 +- src/components/mobile_nav/mobile_nav.vue | 6 ++++-- src/components/modal/modal.vue | 5 ++++- src/components/notifications/notifications.js | 10 ++++++++++ src/components/popover/popover.js | 4 ++++ src/components/popover/popover.vue | 4 ++-- src/components/shout_panel/shout_panel.vue | 2 +- src/components/side_drawer/side_drawer.vue | 2 +- 13 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/App.scss b/src/App.scss index 79c07683..78835c61 100644 --- a/src/App.scss +++ b/src/App.scss @@ -4,6 +4,13 @@ :root { --navbar-height: 3.5rem; --post-line-height: 1.4; + // Z-Index stuff + --ZI_media_modal: 90000; + --ZI_navbar_popovers: 85000; + --ZI_navbar: 80000; + --ZI_modals_popovers: 75000; + --ZI_modals: 70000; + --ZI_popovers: 60000; } html { @@ -117,7 +124,7 @@ i[class*=icon-], } nav { - z-index: 1000; + z-index: var(--ZI_navbar); color: var(--topBarText); background-color: $fallback--fg; background-color: var(--topBar, $fallback--fg); diff --git a/src/boot/after_store.js b/src/boot/after_store.js index f655c38f..894a68e1 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -396,6 +396,9 @@ const afterStoreSetup = async ({ store, i18n }) => { app.component('FAIcon', FontAwesomeIcon) app.component('FALayers', FontAwesomeLayers) + // remove after vue 3.3 + app.config.unwrapInjectedRef = true + app.mount('#app') return app diff --git a/src/components/desktop_nav/desktop_nav.scss b/src/components/desktop_nav/desktop_nav.scss index 0ca9802e..e9a47632 100644 --- a/src/components/desktop_nav/desktop_nav.scss +++ b/src/components/desktop_nav/desktop_nav.scss @@ -2,6 +2,7 @@ .DesktopNav { width: 100%; + z-index: var(--ZI_navbar); a { color: var(--topBarLink, $fallback--link); diff --git a/src/components/emoji_picker/emoji_picker.scss b/src/components/emoji_picker/emoji_picker.scss index 2055e02e..a2f17c51 100644 --- a/src/components/emoji_picker/emoji_picker.scss +++ b/src/components/emoji_picker/emoji_picker.scss @@ -7,7 +7,8 @@ right: 0; left: 0; margin: 0 !important; - z-index: 100; + // TODO: actually use popover in emoji picker + z-index: var(--ZI_popovers); background-color: $fallback--bg; background-color: var(--popover, $fallback--bg); color: $fallback--link; diff --git a/src/components/global_notice_list/global_notice_list.vue b/src/components/global_notice_list/global_notice_list.vue index ddc45b81..09904761 100644 --- a/src/components/global_notice_list/global_notice_list.vue +++ b/src/components/global_notice_list/global_notice_list.vue @@ -32,7 +32,7 @@ top: 50px; width: 100%; pointer-events: none; - z-index: 1001; + z-index: var(--ZI_popovers); display: flex; flex-direction: column; align-items: center; diff --git a/src/components/media_modal/media_modal.vue b/src/components/media_modal/media_modal.vue index b93d3d84..d59055b3 100644 --- a/src/components/media_modal/media_modal.vue +++ b/src/components/media_modal/media_modal.vue @@ -121,7 +121,7 @@ $modal-view-button-icon-width: 3em; $modal-view-button-icon-margin: 0.5em; .modal-view.media-modal-view { - z-index: 900000; + z-index: var(--ZI_media_modal); flex-direction: column; .modal-view-button-arrow, diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index d2d48a03..c58d9e7c 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -86,6 +86,8 @@ @import '../../_variables.scss'; .MobileNav { + z-index: var(--ZI_navbar); + .mobile-nav { display: grid; line-height: var(--navbar-height); @@ -147,7 +149,7 @@ transition-property: transform; transition-duration: 0.25s; transform: translateX(0); - z-index: 1001; + z-index: var(--ZI_navbar); -webkit-overflow-scrolling: touch; &.-closed { @@ -160,7 +162,7 @@ display: flex; align-items: center; justify-content: space-between; - z-index: 1; + z-index: calc(var(--ZI_navbar) + 100); width: 100%; height: 50px; line-height: 50px; diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue index 9394efff..52d8d27e 100644 --- a/src/components/modal/modal.vue +++ b/src/components/modal/modal.vue @@ -22,6 +22,9 @@ export default { default: false } }, + provide: { + popoversZLayer: 'modals' + }, computed: { classes () { return { @@ -35,7 +38,7 @@ export default {