diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue index a2fe6a30d9..0dccb91290 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue @@ -191,11 +191,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) { const newTableDom = document.querySelector(`[data-table-id="${table.id}"]`) if (!newTableDom) return - // Verify that table node is not in the viewport - if (isElementInvisible(newTableDom)) { - // Scroll to the table node - newTableDom?.scrollIntoView({ behavior: 'smooth' }) - } + newTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' }) }, 1000) close(1000) diff --git a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue index 74daf9a809..a2a1bd2094 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue @@ -190,7 +190,7 @@ function onRef(el: HTMLElement) { if (activeViewTitleOrId.value === vModel.value.id) { nextTick(() => { setTimeout(() => { - el?.scrollIntoView({ block: 'center', inline: 'center' }) + el?.scrollIntoView({ block: 'nearest', inline: 'nearest' }) }, 1000) }) } diff --git a/packages/nc-gui/components/dashboard/TreeView/index.vue b/packages/nc-gui/components/dashboard/TreeView/index.vue index f9126cb407..f66c9890ce 100644 --- a/packages/nc-gui/components/dashboard/TreeView/index.vue +++ b/packages/nc-gui/components/dashboard/TreeView/index.vue @@ -212,10 +212,8 @@ const scrollTableNode = () => { const activeTableDom = document.querySelector(`.nc-treeview [data-table-id="${_activeTable.value?.id}"]`) if (!activeTableDom) return - if (isElementInvisible(activeTableDom)) { - // Scroll to the table node - activeTableDom?.scrollIntoView({ behavior: 'smooth' }) - } + // Scroll to the table node + activeTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' }) } watch( diff --git a/packages/nc-gui/components/project/AllTables.vue b/packages/nc-gui/components/project/AllTables.vue index 07f2bb21f7..1f09942514 100644 --- a/packages/nc-gui/components/project/AllTables.vue +++ b/packages/nc-gui/components/project/AllTables.vue @@ -57,11 +57,7 @@ function openTableCreateDialog(baseIndex?: number | undefined) { const newTableDom = document.querySelector(`[data-table-id="${table.id}"]`) if (!newTableDom) return - // Verify that table node is not in the viewport - if (isElementInvisible(newTableDom)) { - // Scroll to the table node - newTableDom?.scrollIntoView({ behavior: 'smooth' }) - } + newTableDom?.scrollIntoView({ behavior: 'smooth', block: 'nearest' }) }, 1000) close(1000)