mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(editor): Autofocus Search in Move Folder Dialog (#14378)
This commit is contained in:
@@ -448,9 +448,9 @@ function moveFolder(folderName: string, destinationName: string) {
|
||||
cy.intercept('PATCH', '/rest/projects/**').as('moveFolder');
|
||||
getMoveFolderModal().should('be.visible');
|
||||
getMoveFolderModal().find('h1').first().contains(`Move "${folderName}" to another folder`);
|
||||
getMoveToFolderDropdown().click();
|
||||
// Try to find current folder in the dropdown
|
||||
getMoveToFolderInput().type(folderName, { delay: 50 });
|
||||
// This tests that auto-focus worked as expected
|
||||
cy.focused().type(folderName, { delay: 50 });
|
||||
// Should not be available
|
||||
getEmptyFolderDropdownMessage('No folders found').should('exist');
|
||||
// Select destination folder
|
||||
|
||||
@@ -98,8 +98,11 @@ const blur = () => {
|
||||
const focusOnInput = () => {
|
||||
if (!innerSelect.value) return;
|
||||
|
||||
const inputRef = innerSelect.value.$refs.input as HTMLInputElement | undefined;
|
||||
inputRef?.focus();
|
||||
const inputRef = innerSelect.value.$refs.selectWrapper as HTMLInputElement;
|
||||
|
||||
const inputElement = inputRef?.querySelector('input');
|
||||
if (inputElement) inputElement.focus();
|
||||
else inputRef?.focus();
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useFoldersStore } from '@/stores/folders.store';
|
||||
import { useProjectsStore } from '@/stores/projects.store';
|
||||
import { type ProjectIcon as ItemProjectIcon, ProjectTypes } from '@/types/projects.types';
|
||||
import { N8nSelect } from '@n8n/design-system';
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
/**
|
||||
* This component is used to select a folder to move a resource (folder or workflow) to.
|
||||
@@ -108,6 +108,10 @@ const onFolderSelected = (folderId: string) => {
|
||||
type: selectedFolder.resource,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
void setTimeout(() => moveFolderDropdown.value?.focusOnInput());
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user