From 3d321827178e291f3965cd0b16394fa5d718b0f6 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Tue, 10 Dec 2024 06:14:45 +0000 Subject: [PATCH] fix(nc-gui): if cell is active and document.activeElement is different then prevent selectedCellKeyupListner event --- .../nc-gui/composables/useSelectedCellKeyupListener/index.ts | 3 ++- packages/nc-gui/utils/browserUtils.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts b/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts index 1b64dbd614..d7896d3caa 100644 --- a/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts +++ b/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts @@ -7,7 +7,8 @@ function useSelectedCellKeyupListener( { immediate = false }: { immediate?: boolean } = {}, ) { const finalHandler = (e: KeyboardEvent) => { - if (cmdKActive()) return + if (cmdKActive() || isExpandedFormOpenExist() || isExpandedCellInputExist() || isFieldEditOrAddDropdownOpen()) return + // TODO: Check if their is any active element which is outside grid then return handler(e) } diff --git a/packages/nc-gui/utils/browserUtils.ts b/packages/nc-gui/utils/browserUtils.ts index e79cb7319c..ec56c84f03 100644 --- a/packages/nc-gui/utils/browserUtils.ts +++ b/packages/nc-gui/utils/browserUtils.ts @@ -14,6 +14,7 @@ export const isActiveInputElementExist = () => { !!document.activeElement?.getAttribute('contenteditable') ) } +export const isFieldEditOrAddDropdownOpen = () => document.querySelector('.nc-dropdown-edit-column.active') export const getScrollbarWidth = () => { const outer = document.createElement('div') outer.style.visibility = 'hidden'