apply focus to form input manually in onAddTool using document.querySelector, instead of with autoFocus

This commit is contained in:
kangabell 2025-04-03 18:16:56 -04:00
parent 3c9cd21bba
commit c8f914623e
2 changed files with 9 additions and 2 deletions

View file

@ -63,8 +63,7 @@ function PluginAuthForm({ plugin, onSubmit, isEntityTool }: TPluginAuthFormProps
message: `${config.label} must be at least 10 characters long`,
},
})}
className="flex h-10 max-h-10 w-full resize-none rounded-md border border-gray-200 bg-transparent px-3 py-2 text-sm text-gray-700 shadow-[0_0_10px_rgba(0,0,0,0.05)] outline-none placeholder:text-gray-400 focus:border-gray-400 focus:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-gray-400 focus:ring-opacity-0 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-500 dark:bg-gray-700 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-gray-400 focus:dark:bg-gray-600 dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0"
autoFocus
className="auth-field flex h-10 max-h-10 w-full resize-none rounded-md border border-gray-200 bg-transparent px-3 py-2 text-sm text-gray-700 shadow-[0_0_10px_rgba(0,0,0,0.05)] outline-none placeholder:text-gray-400 focus:border-gray-400 focus:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-gray-400 focus:ring-opacity-0 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-500 dark:bg-gray-700 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-gray-400 focus:dark:bg-gray-600 dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0"
/>
</HoverCardTrigger>
<PluginTooltip content={config.description} position="right" />

View file

@ -112,6 +112,14 @@ function ToolSelectDialog({
if (authConfig && authConfig.length > 0 && !authenticated) {
setShowPluginAuthForm(true);
setTimeout(() => {
const authField = document.querySelector('.auth-field') as HTMLInputElement;
if (authField) {
authField.focus();
}
}, 100);
} else {
handleInstall({ pluginKey, action: 'install', auth: null });
}