Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Improve modal scroll behavior in VariablesWidget

samme-abdul61d806e65186
diff --git a/packages/app/src/react/features/builder/components/VariablesWidget.tsx b/packages/app/src/react/features/builder/components/VariablesWidget.tsx
index bd9ebab1..c1146d6a 100644
--- a/packages/app/src/react/features/builder/components/VariablesWidget.tsx
+++ b/packages/app/src/react/features/builder/components/VariablesWidget.tsx
@@ -239,16 +239,17 @@ const VariablesWidget = ({ agentId, workspace }: { agentId: string; workspace: W
setKeyErrors({});
setShowVaultKeys(null);
- // Focus on the first input field instead of scrolling the modal into view
const timeout = setTimeout(() => {
if (addKeyModalRef.current) {
- const firstInput = addKeyModalRef.current.querySelector('input') as HTMLInputElement;
- if (firstInput) {
- firstInput.focus();
- }
+ // Use scrollIntoView with more controlled options to prevent jumping to top
+ addKeyModalRef.current.scrollIntoView({
+ behavior: 'smooth',
+ block: 'nearest', // Changed from 'center' to 'nearest'
+ inline: 'nearest', // Added inline positioning
+ });
}
clearTimeout(timeout);
- }, 100);
+ }, 0);
};
const validateNewKey = (): boolean => {