From 94fde26801fb4ab10ef5f9b4961998038bf8c5ec Mon Sep 17 00:00:00 2001 From: lukicenturi Date: Wed, 25 Dec 2024 23:28:21 +0700 Subject: [PATCH] fix(Autocomplete): fix focus in autocomplete --- src/components/forms/auto-complete/RuiAutoComplete.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/forms/auto-complete/RuiAutoComplete.vue b/src/components/forms/auto-complete/RuiAutoComplete.vue index 9b104551..0d20601c 100644 --- a/src/components/forms/auto-complete/RuiAutoComplete.vue +++ b/src/components/forms/auto-complete/RuiAutoComplete.vue @@ -100,6 +100,7 @@ const menuRef = ref(); const menuWrapperRef = ref(); const { focused: activatorFocusedWithin } = useFocusWithin(activator); +const { focused: activatorFocused } = useFocus(activator); const { focused: menuWrapperFocusedWithin } = useFocusWithin(menuWrapperRef); const anyFocused = logicOr(activatorFocusedWithin, menuWrapperFocusedWithin); const debouncedAnyFocused = refDebounced(anyFocused, 100); @@ -306,7 +307,7 @@ async function setValue(val: TItem, index?: number, skipRefocused = false): Prom else { await nextTick(() => { set(isOpen, false); - set(searchInputFocused, false); + set(activatorFocused, true); }); if (get(shouldApplyValueAsSearch)) updateInternalSearch(getText(val)); @@ -658,6 +659,7 @@ defineExpose({ variant="text" icon size="sm" + tabindex="-1" color="error" class="group-hover:!visible" :class="[$style.clear, anyFocused && '!visible', {