@@ -63,7 +63,7 @@ function SignupForm() {
63
63
validateFields = { [ ] }
64
64
>
65
65
{ ( field ) => (
66
- < p className = "form__field" >
66
+ < div className = "form__field" >
67
67
< label htmlFor = "username" className = "form__label" >
68
68
{ t ( 'SignupForm.Title' ) }
69
69
</ label >
@@ -77,14 +77,16 @@ function SignupForm() {
77
77
{ ...field . input }
78
78
/>
79
79
{ field . meta . touched && field . meta . error && (
80
- < span className = "form-error" > { field . meta . error } </ span >
80
+ < span className = "form-error" aria-live = "polite" >
81
+ { field . meta . error }
82
+ </ span >
81
83
) }
82
- </ p >
84
+ </ div >
83
85
) }
84
86
</ Field >
85
87
< Field name = "email" validate = { validateEmail } validateFields = { [ ] } >
86
88
{ ( field ) => (
87
- < p className = "form__field" >
89
+ < div className = "form__field" >
88
90
< label htmlFor = "email" className = "form__label" >
89
91
{ t ( 'SignupForm.Email' ) }
90
92
</ label >
@@ -97,78 +99,82 @@ function SignupForm() {
97
99
{ ...field . input }
98
100
/>
99
101
{ field . meta . touched && field . meta . error && (
100
- < span className = "form-error" > { field . meta . error } </ span >
102
+ < span className = "form-error" aria-live = "polite" >
103
+ { field . meta . error }
104
+ </ span >
101
105
) }
102
- </ p >
106
+ </ div >
103
107
) }
104
108
</ Field >
105
109
< Field name = "password" >
106
110
{ ( field ) => (
107
- < div >
108
- < p className = "form__field" >
109
- < label htmlFor = "password" className = "form__label" >
110
- { t ( 'SignupForm.Password' ) }
111
- </ label >
112
- < div className = "form__field__password" >
113
- < button
114
- className = "form__eye__icon"
115
- type = "button"
116
- onClick = { handleVisibility }
117
- >
118
- { showPassword ? (
119
- < AiOutlineEyeInvisible />
120
- ) : (
121
- < AiOutlineEye />
122
- ) }
123
- </ button >
124
- < input
125
- className = "form__input"
126
- aria-label = { t ( 'SignupForm.PasswordARIA' ) }
127
- type = { showPassword ? 'text' : 'password' }
128
- id = "password"
129
- autoComplete = "new-password"
130
- { ...field . input }
131
- />
132
- </ div >
133
- { field . meta . touched && field . meta . error && (
134
- < span className = "form-error" > { field . meta . error } </ span >
135
- ) }
136
- </ p >
111
+ < div className = "form__field" >
112
+ < label htmlFor = "password" className = "form__label" >
113
+ { t ( 'SignupForm.Password' ) }
114
+ </ label >
115
+ < div className = "form__field__password" >
116
+ < button
117
+ className = "form__eye__icon"
118
+ type = "button"
119
+ onClick = { handleVisibility }
120
+ aria-hidden = "true"
121
+ >
122
+ { showPassword ? (
123
+ < AiOutlineEyeInvisible />
124
+ ) : (
125
+ < AiOutlineEye />
126
+ ) }
127
+ </ button >
128
+ < input
129
+ className = "form__input"
130
+ aria-label = { t ( 'SignupForm.PasswordARIA' ) }
131
+ type = { showPassword ? 'text' : 'password' }
132
+ id = "password"
133
+ autoComplete = "new-password"
134
+ { ...field . input }
135
+ />
136
+ </ div >
137
+ { field . meta . touched && field . meta . error && (
138
+ < span className = "form-error" aria-live = "polite" >
139
+ { field . meta . error }
140
+ </ span >
141
+ ) }
137
142
</ div >
138
143
) }
139
144
</ Field >
140
145
< Field name = "confirmPassword" >
141
146
{ ( field ) => (
142
- < div >
143
- < p className = "form__field" >
144
- < label htmlFor = "confirmPassword" className = "form__label" >
145
- { t ( 'SignupForm.ConfirmPassword' ) }
146
- </ label >
147
- < div className = "form__field__password" >
148
- < button
149
- className = "form__eye__icon"
150
- type = "button"
151
- onClick = { handleConfirmVisibility }
152
- >
153
- { showConfirmPassword ? (
154
- < AiOutlineEyeInvisible />
155
- ) : (
156
- < AiOutlineEye />
157
- ) }
158
- </ button >
159
- < input
160
- className = "form__input"
161
- type = { showConfirmPassword ? 'text' : 'password' }
162
- aria-label = { t ( 'SignupForm.ConfirmPasswordARIA' ) }
163
- id = "confirmPassword" // Match the id with htmlFor
164
- autoComplete = "new-password"
165
- { ...field . input }
166
- />
167
- </ div >
168
- { field . meta . touched && field . meta . error && (
169
- < span className = "form-error" > { field . meta . error } </ span >
170
- ) }
171
- </ p >
147
+ < div className = "form__field" >
148
+ < label htmlFor = "confirmPassword" className = "form__label" >
149
+ { t ( 'SignupForm.ConfirmPassword' ) }
150
+ </ label >
151
+ < div className = "form__field__password" >
152
+ < button
153
+ className = "form__eye__icon"
154
+ type = "button"
155
+ onClick = { handleConfirmVisibility }
156
+ aria-hidden = "true"
157
+ >
158
+ { showConfirmPassword ? (
159
+ < AiOutlineEyeInvisible />
160
+ ) : (
161
+ < AiOutlineEye />
162
+ ) }
163
+ </ button >
164
+ < input
165
+ className = "form__input"
166
+ type = { showConfirmPassword ? 'text' : 'password' }
167
+ aria-label = { t ( 'SignupForm.ConfirmPasswordARIA' ) }
168
+ id = "confirmPassword" // Match the id with htmlFor
169
+ autoComplete = "new-password"
170
+ { ...field . input }
171
+ />
172
+ </ div >
173
+ { field . meta . touched && field . meta . error && (
174
+ < span className = "form-error" aria-live = "polite" >
175
+ { field . meta . error }
176
+ </ span >
177
+ ) }
172
178
</ div >
173
179
) }
174
180
</ Field >
0 commit comments