From 45846554103475564525950925be24803d131100 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 12 Oct 2022 20:36:41 +0530 Subject: [PATCH] fix(gui): scroll to view only if required Signed-off-by: Pranav C --- .../nc-gui/components/smartsheet/Grid.vue | 21 +++---------------- .../composables/useMultiSelect/index.ts | 1 - 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 10bbf9d478..b6270a331a 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -83,6 +83,7 @@ const contextMenuTarget = ref<{ row: number; col: number } | null>(null) const expandedFormDlg = ref(false) const expandedFormRow = ref() const expandedFormRowState = ref>() +const tbodyEl = ref() const { isLoading, @@ -115,8 +116,8 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange // scroll into the active cell td.scrollIntoView({ behavior: 'smooth', - block: 'end', - inline: 'end', + block: 'nearest', + inline: 'nearest', }) } }, @@ -363,22 +364,6 @@ watch( }, { immediate: true }, ) - -const tbodyEl = ref() - -// watch([() => selected.row, () => selected.col], ([row, col]) => { -// if (row !== null && col !== null) { -// // get active cell -// const td = tbodyEl.value?.querySelectorAll('tr')[row]?.querySelectorAll('td')[col + 1] -// if (!td) return -// // scroll into the active cell -// td.scrollIntoView({ -// behavior: 'smooth', -// block: 'end', -// inline: 'end', -// }) -// } -// })