Skip to content

Commit

Permalink
Merge pull request #3219 from nextcloud/fix/prevent-automatic-mounting
Browse files Browse the repository at this point in the history
Allow opting out of automatic NcModal remounting
  • Loading branch information
GretaD authored Sep 16, 2022
2 parents 406a58d + 4a28f2b commit c0b37eb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ export default {
},
/**
* Selector for the modal container
* Selector for the modal container, pass `null` to prevent automatic container mounting
*/
container: {
type: String,
type: [String, null],
default: 'body',
},
Expand Down Expand Up @@ -552,14 +552,15 @@ export default {
this.handleSwipe(e)
})
if (this.container === 'body') {
// force mount the component to body
document.body.insertBefore(this.$el, document.body.lastChild)
} else {
const container = document.querySelector(this.container)
container.appendChild(this.$el)
if (this.container) {
if (this.container === 'body') {
// force mount the component to body
document.body.insertBefore(this.$el, document.body.lastChild)
} else {
const container = document.querySelector(this.container)
container.appendChild(this.$el)
}
}
},
destroyed() {
this.clearFocusTrap()
Expand Down

0 comments on commit c0b37eb

Please sign in to comment.