Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 4 years ago

Animating outwards and JS toggle

Vytas•435
@vytkuklys
A solution to the Project tracking intro component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Suggestions and ideas are valued and appreciated!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted over 4 years ago

    There are a few other suggestions I can make to help you in future projects too ☺

    1. Simplify your js. All your toggle function needs to do is add/remove one class to your nav element. E.g. Add a class like menu-is-open and then control everything visible under that by leveraging that class as a parent selector in your css like:
    .my-menu {
      // css properties for base menu styles and properties to make it hidden  here
    }  
    
    .menu-is-open .my-menu { 
      // css properties to make menu visible here 
    }
    
    1. Use a consistent naming convention for your class names. There's a lot of different hyphens and underlines at the moment. Pick a convention and stick to it (can be bootstrap or tailwind style, can be BEM, can be your own, can be others...)

    2. If you use alternate methods to show / hide that menu instead of the display property, you could animate it with a nice transition. Look up different ways to do this like visibility hidden, height and opacity 0, and/or positioning that menu off screen until its opened.

    3. Try not to set explicit heights (or widths) in css unless absolutely necessary. Use min-height or max- values instead to allow your content to grow and shrink as needed. All that can help you avoid overflow issues in future projects.

    Have fun playing with all that and keep learning. It looks like you're building up a good foundation here 👍

  • Grace•32,130
    @grace-snow
    Posted over 4 years ago

    Hi Vtykuklys,

    This looks great! You just need a few changes to your html and js to make it accessible:

    • place the nav toggle icons inside a button. That way the nav will work with keyboard fully. I can see you've tried to add an enter trigger to it, but space bar is actually what you'd use for this and assistive tech users need more, like focus. Add a really obvious focus state using css and let the interactive html element <button> handle the rest automatically.

    • then remove that bit of js looking for keyup. Won't be needed.

    • then I would hide the open close buttons with aria-hidden="true" on both os them, and add the following to the button aria-label="Open menu" aria-controls="menu" aria-expanded="false" (with menu as the id on your ul)

    • then in your js function that's toggling the nav open and closed, you also set the attributes to aria-label="Close menu" aria-expanded="true" whenever the nav is open.

    • last accessibility improvement is to swap all your h5s for paragraph tags. It's really important for headings to go in order as assistive tech produces a document outline that is used to move around the page.

    Hope those are helpful suggestions for you ☺

  • Abhik•4,820
    @abhik-b
    Posted over 4 years ago

    Hi @vytkuklys , Nice job on this challenge , I liked it very much. It is responsive and Navbar toggling works fine.

    Just a opinion ~ "Login" at the navbar for desktop is unreadable due to its color , giving it a dark color can fix

    Keep contributing these awesome solutions 🚀 & Happy Coding 😇

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub