diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue
index 368c7716b..890e04840 100644
--- a/apps/desktop/src/components/editor/AiAssistant.vue
+++ b/apps/desktop/src/components/editor/AiAssistant.vue
@@ -1287,6 +1287,7 @@ const messageRenderer = computed(() => {
item-class="text-xs px-2"
@update:model-value="(value) => selectAction(value as AiAction)"
/>
+
{
:loading-text="t('ai.loadingModels')"
:loading="modelLoading"
:display-name="displayModelName"
- trigger-class="min-w-0 flex-1 shrink justify-end rounded-full border px-2 py-0.5 text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground"
+ trigger-class="min-w-0 w-auto max-w-[220px] shrink justify-end rounded-full border px-2 py-0.5 text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground"
content-class="w-72"
item-class="text-xs px-2"
@update:model-value="handleModelSelect"
diff --git a/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue b/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
index 61b571b46..3c779aa00 100644
--- a/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
+++ b/apps/desktop/src/components/ui/searchable-select/SearchableSelect.vue
@@ -57,6 +57,20 @@ function highlightSelectedOption() {
highlightIndex.value = selectedIndex >= 0 ? selectedIndex : 0;
}
+async function scrollHighlightedOptionIntoView() {
+ await nextTick();
+ const container = listContainer.value;
+ if (!container || highlightIndex.value < 0) return;
+ const buttons = container.querySelectorAll("button");
+ const target = buttons[highlightIndex.value];
+ target?.scrollIntoView({ block: "nearest" });
+}
+
+function highlightAndScrollSelectedOption() {
+ highlightSelectedOption();
+ void scrollHighlightedOptionIntoView();
+}
+
watch(open, async (value) => {
emit("update:open", value);
if (!value) {
@@ -67,7 +81,7 @@ watch(open, async (value) => {
await nextTick();
const input = searchInput.value?.$el as HTMLInputElement | undefined;
input?.focus();
- highlightSelectedOption();
+ highlightAndScrollSelectedOption();
});
watch(searchText, () => {
@@ -78,19 +92,12 @@ watch(
() => [props.modelValue, props.options],
() => {
if (!open.value || searchText.value) return;
- highlightSelectedOption();
+ highlightAndScrollSelectedOption();
},
{ deep: true },
);
-watch(highlightIndex, async () => {
- await nextTick();
- const container = listContainer.value;
- if (!container || highlightIndex.value < 0) return;
- const buttons = container.querySelectorAll("button");
- const target = buttons[highlightIndex.value];
- target?.scrollIntoView({ block: "nearest" });
-});
+watch(highlightIndex, scrollHighlightedOptionIntoView);
function selectOption(option: string) {
emit("update:modelValue", option);