Ensure focus is not changed to ssh tunnel password input when user explicitly focus on server password input.

This commit is contained in:
Nikhil Mohite 2023-11-28 15:55:48 +05:30 committed by GitHub
parent 412375af3c
commit 37362541bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////
import React, { useState, useRef, useEffect } from 'react';
import React, { useState, useRef, useEffect, useLayoutEffect } from 'react';
import gettext from 'sources/gettext';
import { Box } from '@material-ui/core';
import { DefaultButton, PrimaryButton } from '../components/Buttons';
@ -44,11 +44,10 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight}
}
};
useEffect(()=>{
setTimeout(()=>{
firstEleRef.current && firstEleRef.current.focus();
}, 350);
}, [firstEleRef.current]);
useLayoutEffect(()=>{
firstEleRef.current?.focus();
}, []);
useEffect(()=>{
setHeight?.(containerRef.current?.offsetHeight);