From 4f9851b19e223a579ec034eb7e4ad6ee71fcee1a Mon Sep 17 00:00:00 2001 From: sreehari jayaraj Date: Mon, 2 Oct 2023 10:08:30 +0530 Subject: [PATCH] fix: blur event on outside click --- packages/nc-gui/components/cell/MultiSelect.vue | 2 ++ packages/nc-gui/components/cell/SingleSelect.vue | 1 + packages/nc-gui/components/smartsheet/Cell.vue | 5 ----- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/cell/MultiSelect.vue b/packages/nc-gui/components/cell/MultiSelect.vue index eafeca7270..f2f37a84d5 100644 --- a/packages/nc-gui/components/cell/MultiSelect.vue +++ b/packages/nc-gui/components/cell/MultiSelect.vue @@ -321,6 +321,8 @@ const handleClose = (e: MouseEvent) => { !aselect.value.$el.contains(e.target) && !document.querySelector('.nc-dropdown-multi-select-cell.active')?.contains(e.target as Node) ) { + // loose focus when clicked outside + isEditable.value = false isOpen.value = false } } diff --git a/packages/nc-gui/components/cell/SingleSelect.vue b/packages/nc-gui/components/cell/SingleSelect.vue index 5c0475addf..9dbd3188cc 100644 --- a/packages/nc-gui/components/cell/SingleSelect.vue +++ b/packages/nc-gui/components/cell/SingleSelect.vue @@ -217,6 +217,7 @@ const onKeydown = (e: KeyboardEvent) => { const onSelect = () => { isOpen.value = false + isEditable.value = false } const cellClickHook = inject(CellClickHookInj, null) diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue index 31d5382b69..e7aa423376 100644 --- a/packages/nc-gui/components/smartsheet/Cell.vue +++ b/packages/nc-gui/components/smartsheet/Cell.vue @@ -189,11 +189,6 @@ onMounted(() => { intersectionObserver.value?.observe(elementToObserve.value!) }) -// remove border of element when clicked outside -onClickOutside(elementToObserve as any, () => { - editEnabled.value = false -}) - // disconnect the observer when the cell is unmounted onUnmounted(() => { intersectionObserver.value?.disconnect()