Design comparison
SolutionDesign
Solution retrospective
Any suggest? Does the validation work well? Is there a easier way to perform the validation in JS? Thanks
Community feedback
- @pikapikamartPosted about 3 years ago
Hey, awesome work on this one. Layout in desktop looks great, it is responsive and the mobile state looks great as well.
Jonathan already gave a great feedback, just going to add some suggestions on this as well:
- Avoid using
height: 100vh
on a large container especially thebody
tag as this limits the element's height based on the remaining screen's height. Instead usemin-height: 100vh
, this take full height and let the element expand. - Remove the
width: 100vh
on thebody
as this creates the horizontal scrollbar. This property does not account the horizontal space allotted for the scrollbar. - Too much
id
usage, for styling always useclass
and notid
attribute. - Each
input
needs to have alabel
associated on it. On this one, thelabel
would be a screen-reader onlylabel
meaning it will be invisible for sighted users and only be visible for assistive tech. It will have like asr-only
class. - Each error-message should not be a heading tag, just use
p
tag on it. Each error-message should have anid
attribute. Thisid
will be referenced by theinput
if it was wrong. - If the
input
is wrong, add anaria-invalid="true"
on theinput
, this way users will know that theirinput
is invalid, also add aaria-describedBy
attribute on theinput
the value of this attribute will be theid
of the error-message that is associated with it. If theinput
is wrong, set those like:
if ( input is wrong ) input.setAttribute("aria-invalid", "true"); input.setAttribute("aria-describedBy", { id of the error-message} ); else input.removeAttribute("aria-invalid"); input.removeAttribute("aria-describedBy");
By doing this, you are making your content more accessible for all users.
- Use
button type="submit"
instead ofinput
. - If you are confused on what I had said take a look at my sample snippet for accessible form . You can also see in there the usage of
aria-live
element. This way, if the form is invalid, an assistive tech will inform the user that the form is invalid. - Lastly, you don't need
position: absolute
on thefooter
:>
If you have any queries just drop it here. Again, great work on this one.
Marked as helpful0 - Avoid using
- @Nathan-FrontPosted about 3 years ago
Good job on this, design looks great, although some things to point out.
- The action="" of your form should not be empty, try adding # in it to stop the html error
- The error image is not displaying when error is being displayed.
- Email validation is not being checked even when I enter wrong email format.
- As a newbie in form validation just like me, there are better ways to do it so I recommend you check this out. It was super helpful for me: (https://www.youtube.com/watch?v=rsd4FNGTRBw&t=1449s) Good luck!
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord