From 2636136f87ab9d8ce25ca53be9c219cb4934daed Mon Sep 17 00:00:00 2001 From: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Date: Tue, 9 Dec 2025 01:45:40 +0100 Subject: [PATCH] feat(sidebar): autofocus search input in Workflows, Model, and Node tabs (#7179) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR improves the user experience by automatically focusing the search input field when opening the Workflows, Model Library, or Node Library sidebar tabs. ## Changes - **SearchBox.vue**: Exposed a `focus()` method to allow parent components to programmatically set focus on the input. - **WorkflowsSidebarTab.vue**: Added a watcher to focus the search box when the tab is activated. - **ModelLibrarySidebarTab.vue**: Added autofocus on component mount. - **NodeLibrarySidebarTab.vue**: Added autofocus on component mount. ## Motivation Users often switch to these tabs specifically to search for an item. Automatically focusing the search box reduces friction and saves a click. https://github.com/user-attachments/assets/8438e71c-a5e4-4b6c-8665-04d535d3ad8e ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7179-feat-sidebar-autofocus-search-input-in-Workflows-Model-and-Node-tabs-2c06d73d36508199b8c0e83d19f1cd84) by [Unito](https://www.unito.io) --- src/components/common/SearchBox.vue | 10 ++++++++++ src/components/sidebar/tabs/ModelLibrarySidebarTab.vue | 3 +++ src/components/sidebar/tabs/NodeLibrarySidebarTab.vue | 9 ++++++++- src/components/sidebar/tabs/WorkflowsSidebarTab.vue | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/components/common/SearchBox.vue b/src/components/common/SearchBox.vue index 8fbf3a34a..00b705ce1 100644 --- a/src/components/common/SearchBox.vue +++ b/src/components/common/SearchBox.vue @@ -10,6 +10,7 @@ @click="$emit('showFilter', $event)" /> () +const inputRef = ref() + +defineExpose({ + focus: () => { + inputRef.value?.$el?.focus() + } +}) + const emitSearch = debounce((value: string) => { emit('search', value, filters) }, debounceTime) diff --git a/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue b/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue index 9ff7bd763..c5cf5e9bd 100644 --- a/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue +++ b/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue @@ -21,6 +21,7 @@