
Article Preview Comp. with BEM, SCSS and Vanilla JS
Design comparison
Solution retrospective
When I first started, I couldn't even imagine that this simple design could be challenging at all, but I took me a little longer than I expected. However, I'm really happy how it came out. If you have any feedback, feel free to leave it below.
Community feedback
- @pikapikamartPosted over 3 years ago
Hey, great work on this one. First, it is great that you managed to pull this off, awesome. The layout in desktop looks great, responsive and the mobile layout looks great as well.
Some suggestions would be:
- Avoid using
height: 100vh
on a large container especially thebody
tag, this makes the element's height limited to the remaining viewport/screen's height. Instead usemin-height: 100vh
, this takes full height and allows the element to expand if it needs to. Also you don't need thewidth: 100%
as well. - If you inspect the
.container
selector, you will see that it has no dimension, it is because thefigure
inside it is usingposition: absolute
which makes the element out of the flow. You don't need that in the element. You can remove theposition: absolute
and also, you don't need this on thefigure
:
position: absolute; position: relative; top: 50%; left: 50%; transform: translate(-50%, -50%);
- I think the highlighted text is not really heading tag, since most likely on a testimonial, the person's name should be the heading tag because testimonial doesn't really have a topic title. Instead, I would make use of the
h1
in here as a screen-reader only text, meaning it will use ansr-only
class, you can search that one up and how it is used. alt
value for the person's image should only be the name of the personalt="Michelle Appleton"
. Avoid adding words that relates to "graphic" such as "avatar, image, logo.." since it is already an image, no need to describe it as one.- Name of the person should be a heading tag.
- The toggle works but it is not accessible for all. When creating interactive components, use interactive elements. On this one, you should use
button
and notspan
. Thebutton
will havearia-expanded="false"
as a default attribute. This will be change totrue
if thebutton
is toggled. Since there is no text content inside thebutton
that a screen-reader can read, you would use anaria-label
attribute or ansr-only
element inside thebutton
. The value for whatever method you will use should describe what does thebutton
does. A value could be "social media platform to share info". - The
svg
inside the toggle needs to be hidden since it is just a decoration, so you should addaria-hidden="true"
as an attribute on thesvg
. - The placement of the toggle and the dropdown is incorrect. The dropdown should be placed after the toggle on your markup, swap them up.
- Since the social media links are "list" of links, you could use an
ul
element on them. - The
aria-label
for eacha
tag should be the name of the social media, likealt="facebook"
this way, users will know where this link would take them. - The
svg
inside thea
tag should be hidden, usearia-hidden="true"
on it.
Aside from those, great work again on this one.
Marked as helpful0 - Avoid using
- P@kens-visualsPosted over 3 years ago
Hey @pikamart 👋🏻
Thanks for the feedback, I'll follow up.
position: absolute; position: relative; top: 50%; left: 50%; transform: translate(-50%, -50%);
Also thanks for pointing this out, it was a leftover code from an experiment. Cheers 👾
1 - @kenreibmanPosted over 3 years ago
Hey, I've been stuck on this challenge for a week now - trying to teach myself basic JS to make that sharing preview work.
I've been watching Vanilla JS crash courses, going through the freecodecamp course for JS, but it doesn't seem to explain how I would use JS to do what this project is asking.
Do you have any recommendations or suggestions on how I could teach myself? I don't want to copy someone else's solution without having a thorough understanding.
0P@kens-visualsPosted over 3 years agoHey @lmaoken, my suggestion would be to not rush with JS, if you haven't taken a full-blown course where every little piece is explained in details please do so. If you want any recommendations, here's one, it's on Udemy, and they do have some sales going on occasionally. Don't pay the full price, you can get the entire course for like $18 instead of $200. JS is one of those things that you won't learn with a crash course or a couple of articles, if you want to learn it fundamentally, of course. You can review it with a crash course or use those articles as additional resources, but in my opinion not with a crash course. And for this type of stuff, you'd want to watch some DOM operations. Again, I'm not really familiar with your JS skills and I don't want to assume anything, but this is my suggestion. Get a proper course go through everything and practice every time you learn something new, I'm suggesting this path of learning because JS is a fundamental piece of web development. If you know JS well, you'll easily learn any framework/library, and you'll easily learn node JS. Lastly, yes, never copy anyone's code just for the sake of the completion of the challenge or anything else, unless you fully understand how it works. Because, we, programmers are guilty of copying some code from a Google search result just to make our code work 😅
I hope this was helpful 👨🏻💻 Cheers 👾
1@kenreibmanPosted over 3 years ago@kens-visuals Thank you! I know this was 14 days ago but for the last 14 days I have been teaching myself non-stop. I seem to have grasped the basics and finally was able to complete this on my own! If you could take a look, I would really appreciate it. I believe my js isn't the cleanest, but any feedback on the JavaScript would be amazing!
0
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