Fix click-outside for sidebar
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
<template>
|
||||
<NcContent app-name="deck" :class="{ 'nav-hidden': !navShown, 'sidebar-hidden': !sidebarRouterView }">
|
||||
<AppNavigation />
|
||||
<NcAppContent @click="clickCloseSidebar()">
|
||||
<NcAppContent>
|
||||
<router-view />
|
||||
</NcAppContent>
|
||||
|
||||
@@ -122,11 +122,6 @@ export default {
|
||||
hideModal() {
|
||||
this.$router.push({ name: 'board' })
|
||||
},
|
||||
clickCloseSidebar() {
|
||||
if (this.sidebarShown) {
|
||||
this.$router.push({ name: 'board' })
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<router-view v-if="visible" name="sidebar" />
|
||||
<router-view v-if="visible" v-click-outside="onClickOutside" name="sidebar" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -37,6 +37,12 @@ export default {
|
||||
closeSidebar() {
|
||||
this.$router.push({ name: 'board' })
|
||||
},
|
||||
onClickOutside(e) {
|
||||
if (Array.from(document.querySelectorAll('.card')).some(node => node.contains(e.target))) {
|
||||
return
|
||||
}
|
||||
this.closeSidebar()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user