mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: fix focus behaviour in tags selector
This commit is contained in:
parent
134938dcc9
commit
682ba0bc93
|
@ -14,7 +14,6 @@
|
||||||
multiple
|
multiple
|
||||||
:allowCreate="createEnabled"
|
:allowCreate="createEnabled"
|
||||||
:reserve-keyword="false"
|
:reserve-keyword="false"
|
||||||
default-first-option
|
|
||||||
ref="selectRef"
|
ref="selectRef"
|
||||||
loading-text="..."
|
loading-text="..."
|
||||||
popper-class="tags-dropdown"
|
popper-class="tags-dropdown"
|
||||||
|
@ -178,12 +177,12 @@ export default defineComponent({
|
||||||
|
|
||||||
function onBusFocus() {
|
function onBusFocus() {
|
||||||
focusOnInput();
|
focusOnInput();
|
||||||
focusOnTopOption();
|
focusFirstOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterOptions(value = '') {
|
function filterOptions(value = '') {
|
||||||
filter.value = value.trim();
|
filter.value = value.trim();
|
||||||
void nextTick(() => focusOnTopOption());
|
nextTick(() => focusFirstOption());
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onCreate() {
|
async function onCreate() {
|
||||||
|
@ -225,15 +224,14 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusOnTopOption() {
|
async function focusFirstOption() {
|
||||||
// focus on create option
|
// focus on create option
|
||||||
if (createRef.value?.focus) {
|
if (createRef.value?.focus) {
|
||||||
createRef.value.focus();
|
createRef.value.focus();
|
||||||
}
|
}
|
||||||
// focus on top option after filter
|
// focus on top option after filter
|
||||||
else if (tagRefs.value?.[0]?.$el.focus) {
|
else if (tagRefs.value?.[0]?.$el.focus) {
|
||||||
tagRefs.value[0].$el.focus();
|
tagRefs.value[0].$el.dispatchEvent(new Event('mouseenter'));
|
||||||
console.log('focusing', tagRefs.value[0].$el);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue