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

Audiophile e commerce website using React

react, react-router
Daan Warming•280
@DaanWarming
A solution to the Audiophile e-commerce website challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Roast my semantic HTML usage.

Any tips about my React code are also welcome

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

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

    Hello

    Here is lots of feedback based only on reviewing the home page. Most of these are really foundational things that I would expect you to have well established by the time you came to this project. You may need to go back and do smaller projects to solidify the essential foundations of html and css

    • You're missing a header element. That does not belong in main, it's its own landmark and is designed to hold repeating content that sits atop every page like the logo and navigation.
    • Is "logo" the name of this site and does it communicate the destination of that link? Nope. So either the image alt should say "Audiophile - Home" or the alt left blank and sr-only text or aria-label on the link
    • You have an event listener on an image for the mobile nav toggle. HUGE no-no. Always use interactive elements for interactive behaviour. This follows a classic disclosure pattern that you should be able to write accessibly every single time: nav > button with aria-expanded and label + ul > li > a for the nav links. The button to toggle the nav must sit within the nav element, directly before the list it is toggling. I would not have the logo link inside the nav element
    • Similar for the cart. That's a button if it's interactive.
    • Ideally, when modals open everything else on the page should go inert and focus should move to the modal (see the scott ohara modal dialog pattern for more info). For a junior dev you may not be expected to know this already, but it will be a delightful surprise to any employer that you'd thought this through.
    • Capitalise text via CSS, never in the html
    • You're missing a h1. Headings should go in order and properly communicate the structure of the page
    • Sections always need headings. Even if they are sr-only (visually hidden but accessible). If it shouldn't have a heading, it shouldn't be a section
    • The product categories eg Headphones are headings
    • Alt text should be a meaningful description of the image and should never include words like "image" or "picture. It is already an img element, with an image role
    • Decorative images like chevron icons must have empty alt like alt=""
    • Why is ZX7 SPEAKER a h4? Does it belong to the ZX9 SPEAKER content above? If not, then it must not be a lower heading level. Again, headings must go in an appropriate order to communicate the structure of the content, much like a contents page in a long document. Same issue with BRINGING YOU THE BEST AUDIO GEAR being a h5. That makes no sense
    • You can't have alt on a background image. If it is a meaningful image it should be in the html as an img tag and have proper alt text. If it is a meaningless (decorative) image it can be a background image
    • Similar, you don't use title attribute to label images. Img tag and alt if it is a meaningful image
    • If you have a nav in the footer, you should use another nav element there. The aria-label on the header nav can be Main site or something; and the aria-label on the footer nav can be footer
    • With social links you cant have 3 different icons wrapped in one completely unrelated link. They should each be a link to the relevant site, labelled, and in a list. As they go to external sites, usually these links would be set to open in a new window. That is a good use for the title attribute to say (opens in new tab)

    Looking at the CSS, I am concerned at the amount of explicit widths and heights on things. Go into your browser settings, select to zoom text only then zoom in on the browser. You will see literally everything break because of all the fixed heights/widths used in px Instead, prefer min-height and max-width for containers. This will give you much more responsive layouts because it allows the height to grow and the width to shrink as needed. Alternatively there are functions like min() max() clamp() or minmax and units like fr when using grid and flex-basis -grow and shrink when using flex

    Don't put max width in pixels on any text element like a heading or paragraph. That should only ever be in a responsive unit like ch

    Font size should never be in px, use rem

    I hope this is 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
Frontend Mentor logo

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