From 101277bea7a207ecc4b09e516ee4b53b25298647 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 13 Oct 2022 17:46:18 +0530 Subject: [PATCH 1/2] fix(gui): focus title field only if there is no active element Signed-off-by: Pranav C --- .../smartsheet/column/EditOrAdd.vue | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 39009d6354..2ff1139483 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -51,12 +51,12 @@ const uiTypesOptions = computed(() => { ...uiTypes.filter((t) => !isEdit.value || !t.virtual), ...(!isEdit.value && meta?.value?.columns?.every((c) => !c.pk) ? [ - { - name: UITypes.ID, - icon: MdiIdentifierIcon, - virtual: 0, - }, - ] + { + name: UITypes.ID, + icon: MdiIdentifierIcon, + virtual: 0, + }, + ] : []), ] }) @@ -91,8 +91,11 @@ watchEffect(() => { if (antInput.value && formState.value) { // todo: replace setTimeout setTimeout(() => { - antInput.value?.focus() - antInput.value?.select() + // focus and select input only if active element is not an input or textarea + if (document.activeElement === document.body || document.activeElement === null) { + antInput.value?.focus() + antInput.value?.select() + } }, 300) } advancedOptions.value = false @@ -145,7 +148,8 @@ onMounted(() => { dropdown-class-name="nc-dropdown-column-type" @change="onUidtOrIdTypeChange" > - +
{{ opt.name }} @@ -159,9 +163,11 @@ onMounted(() => { - + - + Date: Thu, 13 Oct 2022 18:00:16 +0530 Subject: [PATCH 2/2] chore(gui): lint Signed-off-by: Pranav C --- .../smartsheet/column/EditOrAdd.vue | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 2ff1139483..3f7f342274 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -51,12 +51,12 @@ const uiTypesOptions = computed(() => { ...uiTypes.filter((t) => !isEdit.value || !t.virtual), ...(!isEdit.value && meta?.value?.columns?.every((c) => !c.pk) ? [ - { - name: UITypes.ID, - icon: MdiIdentifierIcon, - virtual: 0, - }, - ] + { + name: UITypes.ID, + icon: MdiIdentifierIcon, + virtual: 0, + }, + ] : []), ] }) @@ -148,8 +148,7 @@ onMounted(() => { dropdown-class-name="nc-dropdown-column-type" @change="onUidtOrIdTypeChange" > - +
{{ opt.name }} @@ -163,11 +162,9 @@ onMounted(() => { - + - +