focus password field when login page loads

This commit is contained in:
QuickMythril
2024-12-03 04:40:43 -05:00
parent 6ca1c6a578
commit 6ec6e8f2d3
2 changed files with 11 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import { Button, InputAdornment, TextField, TextFieldProps, styled } from "@mui/material";
import { useState } from 'react'
import React, { forwardRef, useState } from 'react'
export const CustomInput = styled(TextField)({
width: "183px", // Adjust the width as needed
@@ -41,7 +41,7 @@ export const CustomInput = styled(TextField)({
});
export const PasswordField: React.FunctionComponent<TextFieldProps> = ({ ...props }) => {
export const PasswordField = forwardRef<HTMLInputElement, TextFieldProps>( ({ ...props }, ref) => {
const [canViewPassword, setCanViewPassword] = useState(false);
return (
<CustomInput
@@ -55,7 +55,8 @@ export const PasswordField: React.FunctionComponent<TextFieldProps> = ({ ...prop
</InputAdornment>
)
}}
inputRef={ref}
{...props}
/>
)
}
});