Responsive intro-section made with tailwindcss and javascript

Solution retrospective
I learned a lot about javascript with this project, especially with the drop down menus. There is still a lot I need to polish with this project and I would love some feedback on what to improve on and how to add the shadow overlay without breaking the side nav menu in mobile view.
What specific areas of your project would you like help with?How to make the menus open one at a time, and have them close if anywhere on the page but the menu element itself is clicked on. I would also love to know how to get the shadow overlay when the side menu opens to work without it breaking the page, if you look at my solution I already attempted it with an empty div but that seems to break the code, any solution on how to go about that is welcome.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @grace-snow
I'm afraid this overflows my mobile screen a lot and behaves strangely when the mobile menu is open because I can still scroll. I'm away from a computer but I expect there may be problems at other screen sizes too.
Before that though, I'll go through the html and list out some necessary changes & recommended improvements as those are the most important to start with...
- The mobile menu (hamburger) menu button must be the first element inside the nav. This is so that assistive tech users can find it easily.
- That same button must have an aria-expanded attribute, whose boolean value will toggle between false and true on click (thus communicating the state of the disclosure to assistive tech, if its expanded or collapsed). This is necessary on all buttons that trigger a disclosure so is needed on all of these "dropdown" triggers within the nav. They are not anchors. I've written up a full post about disclosure UI code and recommend you read it.
- Additionally, I recommend the hamburger open/close buttons are just one button. You can change which icon is visible within the button based on its aria-expanded state (true/false).
- The hamburger menu button must have an accessible name. Currently you are using the image alt for that, which is OK but it would need to say "navigation toggle" instead of "hamburger menu" and "close menu icon". Alternatively you could leave alt blank on those icon images and use aria-label on the button instead, or visually-hidden label text inside the button. The way you choose to solve it is your choice from those options.
- "Register" should be an anchor not a button. Same with "learn more".
- The paragraph underneath the h1 is definitely not an article. Make sure you understand what that landmark is for.
- The company logos are important content, not decorative in my opinion. You have to ask - are they included for a reason? It's to show clients. That's valuable information for people to know about a brand/service so must not be hidden from assistive tech users.
- I also think you are misusing the section element. This doesn't particularly matter as sections only have meaning when they are labelled. But as a general rule think of a section as a significant chunk of content that always has a heading, usually a h2). It should not be used as a generic wrapper for an image just to make a layout work. That's what a div is for.
- Try to make sure all content is contained within landmarks. That means the attribution should be in a footer.
- If links ever open in a new tab, make sure they include some visually-hidden text (eg in a span) that communicates that behaviour eg "(opens in a new tab)"
- Don't have empty divs in the html for no reason. I see one at the end of the nav for example.
Marked as helpful
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