Merge pull request #8793 from aignatov-bio/ai-sci-12250-fix-nested-general-dropdown

Fix nested general dropdown [SCI-12250]
This commit is contained in:
Martin Artnik 2025-08-14 11:11:31 +02:00 committed by GitHub
commit cedfc21846
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@
<template v-if="isOpen">
<teleport to="body">
<div @click="closeOnClick && closeMenu()" ref="flyout"
:id="randomId"
class="sn-dropdown fixed z-[3000] bg-sn-white inline-block
rounded p-2.5 sn-shadow-menu-sm"
:class="{
@ -42,7 +43,8 @@ export default {
},
data() {
return {
isOpen: false
isOpen: false,
randomId: `dropdown-${Math.random().toString(36).substring(2, 15)}`,
};
},
directives: {
@ -70,7 +72,7 @@ export default {
}
},
closeMenu(e) {
if (e && e.target.closest('.sn-dropdown, .sn-select-dropdown, .sn-menu-dropdown, .dp__instance_calendar')) return;
if (e && e.target.closest(`.sn-dropdown#${this.randomId}, .sn-select-dropdown, .sn-menu-dropdown, .dp__instance_calendar`)) return;
this.isOpen = false;
}
}