Skip to content

Commit

Permalink
added aria attributes to forms (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash905 authored Jul 28, 2023
1 parent 5627ca6 commit 76b8aba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export default function LogIn({ setModal }: setModalType) {
}
};
return (
<form onSubmit={handleFormSubmit(submitData)} aria-label="Login-form">
<form
onSubmit={handleFormSubmit(submitData)}
aria-label="Login-form"
role="form"
>
<ToastContainer
position="bottom-center"
autoClose={5000}
Expand All @@ -124,7 +128,7 @@ export default function LogIn({ setModal }: setModalType) {
theme={theme}
/>
<fieldset className="mt-2 text-center font-sans text-base font-semibold">
Login with your email
<legend>Login with your email</legend>
<hr className="mt-3" />
</fieldset>
<div className="dark:text-black">
Expand All @@ -136,6 +140,8 @@ export default function LogIn({ setModal }: setModalType) {
placeholder="Email"
aria-label="Enter your email"
aria-describedby="email-error"
required
aria-required="true"
/>
{errors.email && (
<div
Expand All @@ -156,11 +162,14 @@ export default function LogIn({ setModal }: setModalType) {
className="mx-auto h-10 w-72 max-w-full rounded-lg pl-5 outline outline-2 outline-offset-1 outline-blue-400 placeholder:text-gray-500 focus:outline-4"
aria-label="Enter your password"
aria-describedby="password-error"
required
aria-required="true"
/>
<button
className="absolute inset-y-0 right-1 flex items-center px-4 text-gray-600 md:right-16"
onClick={(e) => togglePasswordVisibility(e)}
aria-label={isPasswordVisible ? 'Hide Password' : 'Show Password'}
type="button"
>
{isPasswordVisible ? (
<svg
Expand Down
16 changes: 14 additions & 2 deletions src/components/Auth/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ export default function SignUp({ setModal }: setModalType) {
};

return (
<form onSubmit={handleFormSubmit(submitData)} aria-label="Register form">
<form
onSubmit={handleFormSubmit(submitData)}
aria-label="Register form"
role="form"
>
<fieldset className="mt-2 text-center font-sans text-base font-semibold ">
Sign up with your email
<legend>Sign up with your email</legend>
<hr className="mt-3" />
</fieldset>

Expand All @@ -131,6 +135,8 @@ export default function SignUp({ setModal }: setModalType) {
placeholder="Enter Your Name"
aria-label="Enter your name"
aria-describedby="name-error"
required
aria-required="true"
/>
{errors.name && (
<p
Expand All @@ -151,6 +157,8 @@ export default function SignUp({ setModal }: setModalType) {
placeholder="Email"
aria-label="Enter your email"
aria-describedby="email-error"
required
aria-required="true"
/>
{errors.email && (
<p
Expand All @@ -170,6 +178,8 @@ export default function SignUp({ setModal }: setModalType) {
placeholder="Create New Password"
aria-label="Enter your password"
aria-describedby="password-error"
required
aria-required="true"
/>
{errors.password && (
<p
Expand All @@ -189,6 +199,8 @@ export default function SignUp({ setModal }: setModalType) {
placeholder="Confirm Password"
aria-label="Confirm your password"
aria-describedby="confirmPassword-error"
required
aria-required="true"
/>
{errors.confirmPassword && (
<p
Expand Down

0 comments on commit 76b8aba

Please sign in to comment.