mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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');
|
cy.intercept('PATCH', '/rest/projects/**').as('moveFolder');
|
||||||
getMoveFolderModal().should('be.visible');
|
getMoveFolderModal().should('be.visible');
|
||||||
getMoveFolderModal().find('h1').first().contains(`Move "${folderName}" to another folder`);
|
getMoveFolderModal().find('h1').first().contains(`Move "${folderName}" to another folder`);
|
||||||
getMoveToFolderDropdown().click();
|
|
||||||
// Try to find current folder in the dropdown
|
// 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
|
// Should not be available
|
||||||
getEmptyFolderDropdownMessage('No folders found').should('exist');
|
getEmptyFolderDropdownMessage('No folders found').should('exist');
|
||||||
// Select destination folder
|
// Select destination folder
|
||||||
|
|||||||
@@ -98,8 +98,11 @@ const blur = () => {
|
|||||||
const focusOnInput = () => {
|
const focusOnInput = () => {
|
||||||
if (!innerSelect.value) return;
|
if (!innerSelect.value) return;
|
||||||
|
|
||||||
const inputRef = innerSelect.value.$refs.input as HTMLInputElement | undefined;
|
const inputRef = innerSelect.value.$refs.selectWrapper as HTMLInputElement;
|
||||||
inputRef?.focus();
|
|
||||||
|
const inputElement = inputRef?.querySelector('input');
|
||||||
|
if (inputElement) inputElement.focus();
|
||||||
|
else inputRef?.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useFoldersStore } from '@/stores/folders.store';
|
|||||||
import { useProjectsStore } from '@/stores/projects.store';
|
import { useProjectsStore } from '@/stores/projects.store';
|
||||||
import { type ProjectIcon as ItemProjectIcon, ProjectTypes } from '@/types/projects.types';
|
import { type ProjectIcon as ItemProjectIcon, ProjectTypes } from '@/types/projects.types';
|
||||||
import { N8nSelect } from '@n8n/design-system';
|
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.
|
* 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,
|
type: selectedFolder.resource,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void setTimeout(() => moveFolderDropdown.value?.focusOnInput());
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user