Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Intro and Dropdown

Kian 150

@kiangopez

Desktop design screenshot for the Intro section with dropdown navigation coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


I think I did terrible with the dropdowns. I want to learn the best practices and feedbacks would be greatly appreciated.

Community feedback

Elaine 11,400

@elaineleung

Posted

Hi Kian, well done here in putting this together, which isn't easy to do, given how many parts there are in this challenge! Anyway, about the dropdowns, what I did when I worked on this challenge is that I used Heydon Pickering's post on menus and menu buttons as a blueprint since I wanted to try to make my dropdown menus as accessible as possible. I don't think I did a super job as it's still missing a few things (like data-visible), but it's functional, so if you're interested you can check out the draft I put together on CodePen here: https://codepen.io/elaineleung/pen/poLpzge

One thing I wanted to point out in your solution is that, where you have nav right now, I actually would use the header landmark instead; the nav should strictly just contain the navigation links and not the site logo.

I hope some of this can help you out, and once again, great work! 🙂

Marked as helpful

2

Kian 150

@kiangopez

Posted

@elaineleung That's what I was also thinking with the header and nav tags I was confused. Thank you for the resources would check it out.

1
Patrick 800

@PPechmann

Posted

Hey @kiangopez,

nice job on this challenge. I also assume you do not have access to the figma file, which gives it even more merit!

Regarding the dropdowns, they are working fine, I would only make some adjustments:

  • Add an eventlistener for the window when it resizes and remove the dropdown classes when activated. This will ensure that the dropdown doesn't stay open, when changing screen sizes (for example turning the phone to landscape mode).

  • In the eventlisteners for each dropdown, also toggle the classes to be able to close one dropdown, when another one opens.

My approach is far from perfect, but you can check my code here to get an idea of what I mean.

Hope this helps!

Happy coding and happy weekend :)

Patrick

Marked as helpful

1

Kian 150

@kiangopez

Posted

@PPechmann Thanks for the tips would apply this. Your code was awesome :)

1
Patrick 800

@PPechmann

Posted

@kiangopez Thank you for your kind words, I am sure it can be improved a lot still. I am still waiting for feedback from some experienced coders here :)

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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