Design comparison
Solution retrospective
So this was interesting. I'm quite new to working with JavaScript, so a lot of the code took way longer than it should have. But (I think) I got it to work. Also learned about Sass mixins, so gave those a shot to deal with the shadow effect. Once again, any and all tips and advice are greatly appreciated :)
Community feedback
- @mattstuddertPosted over 4 years ago
Great work again, Senatrius! Your solution looks really good and scales down well to mobile. Here are a few pointers after looking at your code:
- You've added labels for the inputs, which is great. But you're currently setting the
.accessibility-requirement
class todisplay: none;
which will actually remove that content for screen reader users, which is who you want that content to be accessible for. I'd recommend reading this article on WebAIM about screen reader only content to learn some other approaches. Also, the content inside each of thelabel
elements literally says "Label", whereas this should be the labeling text for theinput
it is associated with. So, if it's alabel
for the first name field, the content should be "First Name". - Your JS looks good and you've structured it well. The one thing it's not doing at the moment is removing the errors once a valid input has been provided.
- I've noticed that you're using
max-width
media queries on all of your projects. Have you ever tried usingmin-width
media queries instead ofmax-width
? It's quite a common workflow with front-end developers to use them and work mobile-first. It can often lead to less CSS code and has the benefit of loading in fewer styles for mobile users, which can be a nice performance gain. I'd recommend giving it a go on a future project!
I hope this feedback helps. Keep up the great work! 👍
1@SenatriusPosted over 4 years ago@mattstuddert Ah yes, that label thing was more of a work around than anything else :) There doesn't seem to be a label in the design preview but leaving the labels out would give me HTML validation errors, so since I couldn't think of anything else I just decided to add the labels and then make them invisible. It's definitely a super janky and probably breaks all kinds of guidelines, but it (sorta) did the job.
I'll definitely be looking into that one in future projects. Only recently learned of a blur event listener which should work decently well in cases like this.
Have heard of them, never used them since I didn't think it made a huge difference. But you bring up a good point, it would load less code at the start on mobile devices and I'm sure PCs could handle a few extra lines :)
Thank you for all of the advice. Will be definitely taking these to heart :)
0@mattstuddertPosted over 4 years ago@Senatrius you're welcome! Yeah, I would definitely try practicing building accessible websites while doing these challenges. It's such a big part of being a front-end developer and is often neglected.
1 - You've added labels for the inputs, which is great. But you're currently setting the
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