Skip to content

Commit

Permalink
Merge pull request #11222 from nextcloud/fix/8709/set-modal-targeting
Browse files Browse the repository at this point in the history
fix: use body element if not the fullscreen
  • Loading branch information
nickvergessen authored Dec 18, 2023
2 parents 245b167 + 182faca commit f0af070
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,11 @@ export default {
.mx-datepicker-main.mx-datepicker-popup {
z-index: 10001 !important;
}

/* FIXME: remove after https://github.com/nextcloud-libraries/nextcloud-vue/pull/4959 is released */
body .modal-wrapper * {
box-sizing: border-box;
}
</style>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CallView/shared/ViewerOverlayCallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default {
},

portalSelector() {
return this.$store.getters.isFullscreen() ? '#content-vue' : 'body'
return this.$store.getters.getMainContainerSelector()
},

hasLocalScreen() {
Expand Down
13 changes: 12 additions & 1 deletion src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

<!-- Input field -->
<NewMessage v-if="containerId"
:key="containerId"
role="region"
:token="token"
:container="containerId"
Expand Down Expand Up @@ -145,11 +146,21 @@ export default {
token() {
return this.$store.getters.getToken()
},

container() {
return this.$store.getters.getMainContainerSelector()
}
},

watch: {
container(value) {
this.containerId = value
}
},

mounted() {
// Postpone render of NewMessage until application is mounted
this.containerId = this.$store.getters.getMainContainerSelector()
this.containerId = this.container
},

methods: {
Expand Down
11 changes: 11 additions & 0 deletions src/components/TopBar/TopBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ import VideoIcon from 'vue-material-design-icons/Video.vue'
import GridView from 'vue-material-design-icons/ViewGrid.vue'

import { getCapabilities } from '@nextcloud/capabilities'
import { showWarning } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'

import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
Expand Down Expand Up @@ -392,6 +393,16 @@ export default {
},

toggleFullscreen() {
// Don't toggle fullscreen if there is an open modal
// FIXME won't be needed without Fulscreen API
if (Array.from(document.body.childNodes).filter(child => {
return child.nodeName === 'DIV' && child.classList.contains('modal-mask')
&& window.getComputedStyle(child).display !== 'none'
}).length !== 0) {
showWarning(t('spreed', 'You need to close a dialog to toggle full screen'))
return
}

if (this.isFullscreen) {
this.disableFullscreen()
this.$store.dispatch('setIsFullscreen', false)
Expand Down
4 changes: 2 additions & 2 deletions src/store/uiModeStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const state = {
}

const getters = {
getMainContainerSelector: (state) => () => {
return state.mainContainerSelector
getMainContainerSelector: (state, getters, rootState, rootGetters) => () => {
return rootGetters.isFullscreen() ? state.mainContainerSelector : 'body'
},
}

Expand Down

0 comments on commit f0af070

Please sign in to comment.