slight z-index refactor and attempt at organizing it

This commit is contained in:
Henry Jameson 2022-06-22 00:30:10 +03:00
parent 93293db038
commit 872db65fd8
13 changed files with 42 additions and 11 deletions

View File

@ -4,6 +4,13 @@
:root { :root {
--navbar-height: 3.5rem; --navbar-height: 3.5rem;
--post-line-height: 1.4; --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 { html {
@ -117,7 +124,7 @@ i[class*=icon-],
} }
nav { nav {
z-index: 1000; z-index: var(--ZI_navbar);
color: var(--topBarText); color: var(--topBarText);
background-color: $fallback--fg; background-color: $fallback--fg;
background-color: var(--topBar, $fallback--fg); background-color: var(--topBar, $fallback--fg);

View File

@ -396,6 +396,9 @@ const afterStoreSetup = async ({ store, i18n }) => {
app.component('FAIcon', FontAwesomeIcon) app.component('FAIcon', FontAwesomeIcon)
app.component('FALayers', FontAwesomeLayers) app.component('FALayers', FontAwesomeLayers)
// remove after vue 3.3
app.config.unwrapInjectedRef = true
app.mount('#app') app.mount('#app')
return app return app

View File

@ -2,6 +2,7 @@
.DesktopNav { .DesktopNav {
width: 100%; width: 100%;
z-index: var(--ZI_navbar);
a { a {
color: var(--topBarLink, $fallback--link); color: var(--topBarLink, $fallback--link);

View File

@ -7,7 +7,8 @@
right: 0; right: 0;
left: 0; left: 0;
margin: 0 !important; margin: 0 !important;
z-index: 100; // TODO: actually use popover in emoji picker
z-index: var(--ZI_popovers);
background-color: $fallback--bg; background-color: $fallback--bg;
background-color: var(--popover, $fallback--bg); background-color: var(--popover, $fallback--bg);
color: $fallback--link; color: $fallback--link;

View File

@ -32,7 +32,7 @@
top: 50px; top: 50px;
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
z-index: 1001; z-index: var(--ZI_popovers);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@ -121,7 +121,7 @@ $modal-view-button-icon-width: 3em;
$modal-view-button-icon-margin: 0.5em; $modal-view-button-icon-margin: 0.5em;
.modal-view.media-modal-view { .modal-view.media-modal-view {
z-index: 900000; z-index: var(--ZI_media_modal);
flex-direction: column; flex-direction: column;
.modal-view-button-arrow, .modal-view-button-arrow,

View File

@ -86,6 +86,8 @@
@import '../../_variables.scss'; @import '../../_variables.scss';
.MobileNav { .MobileNav {
z-index: var(--ZI_navbar);
.mobile-nav { .mobile-nav {
display: grid; display: grid;
line-height: var(--navbar-height); line-height: var(--navbar-height);
@ -147,7 +149,7 @@
transition-property: transform; transition-property: transform;
transition-duration: 0.25s; transition-duration: 0.25s;
transform: translateX(0); transform: translateX(0);
z-index: 1001; z-index: var(--ZI_navbar);
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
&.-closed { &.-closed {
@ -160,7 +162,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
z-index: 1; z-index: calc(var(--ZI_navbar) + 100);
width: 100%; width: 100%;
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;

View File

@ -22,6 +22,9 @@ export default {
default: false default: false
} }
}, },
provide: {
popoversZLayer: 'modals'
},
computed: { computed: {
classes () { classes () {
return { return {
@ -35,7 +38,7 @@ export default {
<style lang="scss"> <style lang="scss">
.modal-view { .modal-view {
z-index: 2000; z-index: var(--ZI_modals);
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;

View File

@ -1,3 +1,4 @@
import { computed } from 'vue'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Notification from '../notification/notification.vue' import Notification from '../notification/notification.vue'
import NotificationFilters from './notification_filters.vue' import NotificationFilters from './notification_filters.vue'
@ -38,6 +39,11 @@ const Notifications = {
seenToDisplayCount: DEFAULT_SEEN_TO_DISPLAY_COUNT seenToDisplayCount: DEFAULT_SEEN_TO_DISPLAY_COUNT
} }
}, },
provide () {
return {
popoversZLayer: computed(() => this.popoversZLayer)
}
},
computed: { computed: {
mainClass () { mainClass () {
return this.minimalMode ? '' : 'panel panel-default' return this.minimalMode ? '' : 'panel panel-default'
@ -75,6 +81,10 @@ const Notifications = {
} }
return map[layoutType] || '#notifs-sidebar' return map[layoutType] || '#notifs-sidebar'
}, },
popoversZLayer () {
const { layoutType } = this.$store.state.interface
return layoutType === 'mobile' ? 'navbar' : null
},
notificationsToDisplay () { notificationsToDisplay () {
return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount) return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount)
}, },

View File

@ -42,6 +42,7 @@ const Popover = {
// What selector (witin popover!) to use for determining center of popover // What selector (witin popover!) to use for determining center of popover
overlayCentersSelector: String overlayCentersSelector: String
}, },
inject: ['popoversZLayer'], // override popover z layer
data () { data () {
return { return {
hidden: true, hidden: true,
@ -168,6 +169,9 @@ const Popover = {
top: `${Math.round(translateY)}px` top: `${Math.round(translateY)}px`
} }
if (this.popoversZLayer) {
this.styles['--ZI_popover_override'] = `var(--ZI_${this.popoversZLayer}_popovers)`
}
if (parentScreenBox) { if (parentScreenBox) {
this.styles.maxWidth = `${Math.round(parentScreenBox.width)}px` this.styles.maxWidth = `${Math.round(parentScreenBox.width)}px`
} }

View File

@ -43,7 +43,7 @@
} }
.popover { .popover {
z-index: 90000; z-index: var(--ZI_popover_override, var(--ZI_popovers));
position: fixed; position: fixed;
min-width: 0; min-width: 0;
max-width: calc(100vw - 20px); max-width: calc(100vw - 20px);
@ -87,7 +87,7 @@
text-align: left; text-align: left;
list-style: none; list-style: none;
max-width: 100vw; max-width: 100vw;
z-index: 200; z-index: var(--ZI_popover_override, var(--ZI_popovers));
white-space: nowrap; white-space: nowrap;
.dropdown-divider { .dropdown-divider {

View File

@ -80,7 +80,7 @@
.floating-shout { .floating-shout {
position: fixed; position: fixed;
bottom: 0.5em; bottom: 0.5em;
z-index: 1000; z-index: var(--ZI_popovers);
max-width: 25em; max-width: 25em;
&.-left { &.-left {

View File

@ -211,7 +211,7 @@
.side-drawer-container { .side-drawer-container {
position: fixed; position: fixed;
z-index: 1000; z-index: var(--ZI_navbar);
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;