mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-01 14:56:53 +00:00
fix: baselist modal search input auto focus issue on performing any base action
This commit is contained in:
@@ -27,8 +27,7 @@ const closeModal = () => {
|
||||
}
|
||||
const { dialogState } = useProvideBaseActions(closeModal)
|
||||
|
||||
// Autofocus search input
|
||||
const focus: VNodeRef = (el) => el?.focus()
|
||||
const searchInputRef = ref<HTMLInputElement>()
|
||||
|
||||
// Responsive state
|
||||
const windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1024)
|
||||
@@ -71,6 +70,18 @@ watch(visible, (isVisible) => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
searchInputRef,
|
||||
() => {
|
||||
if (!searchInputRef.value) return
|
||||
|
||||
searchInputRef.value.focus()
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
|
||||
const workspaceBases = computed(() => {
|
||||
return basesList.value
|
||||
})
|
||||
@@ -168,7 +179,7 @@ const hasNoSearchResults = computed(() => {
|
||||
class="flex items-center px-4 py-3 border-b border-nc-border-gray-medium dark:bg-nc-bg-gray-extralight"
|
||||
>
|
||||
<a-input
|
||||
:ref="focus"
|
||||
ref="searchInputRef"
|
||||
v-model:value="modalState.searchQuery"
|
||||
class="nc-workspace-base-search"
|
||||
:placeholder="$t('placeholder.searchWorkspacesAndBases')"
|
||||
|
||||
Reference in New Issue
Block a user