diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 0a101e3946..3e773052f9 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -327,6 +327,22 @@ 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', + }) + } +})