qfix: handle outside clicks only when popup is top level (#9972)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2025-09-30 09:34:19 +04:00
committed by GitHub
parent fe6d015eb2
commit 138602915c
3 changed files with 19 additions and 4 deletions
@@ -4,10 +4,12 @@
import chunter, { type ChatMessage } from '@hcengineering/chunter'
import { Ref, generateId } from '@hcengineering/core'
import { ReferenceInput } from '@hcengineering/text-editor-resources'
import { popupstore as popups } from '@hcengineering/ui'
import { addDocumentCommentFx } from '../../../stores/editors/document'
export let nodeId: string | undefined
export let popupId: string | undefined
const dispatch = createEventDispatcher()
@@ -22,7 +24,8 @@
function handleClick (event: MouseEvent): void {
if (event.target instanceof Node) {
if (popup !== undefined && !popup.contains(event.target)) {
const top = $popups.length > 0 && $popups[$popups.length - 1].id === popupId
if (top && popup !== undefined && !popup.contains(event.target)) {
event.preventDefault()
event.stopPropagation()
dispatch('close', undefined)