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

Mobile first rating component using Flexbox and JavaScript DOM

accessibility
Ahmet Hakan•80
@ahmetwithat
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


How can I make this component more accessible? Are there any issues with the units i have used in CSS? Did I use the ARIA roles and properties correctly? I couldn't make the circles around the icon and rating options center the element they are containing. How could i have achieved this?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Yefree Valdez•940
    @yefreescoding
    Posted almost 2 years ago

    👋 I can give you some tips and advice and, I'll try to give you a good answer for each one of your questions:

    • How can I make this component more accessible?

    To make your code, or this component more specifically, more accesible you should use semantic HTML tags such as header, main, section, aside, article, h1, h2, quote, form. Checking your code I found some issues, there's way too many <div> 😅. You did a great job tho naming the classes, but to make your code more readable you can do something like this:

    <div class="wrapper flex-col">
      <main class="rating-wrapper">
        <article class="rating-component">
           <div class="star-icon"></div>
           <h1 class="rating-title">How did we do?</h1>
           <p class="rating-description">Please let us kno [...]</p>
        </article>
        <form class="rating-form">
          <input type="radio" name="rating" value="1" class="user-rating-button" checked>1</input>
          <input type="radio" name="rating" value="2" class="user-rating-button" checked>2</input>
          <input type="radio" name="rating" value="3" class="user-rating-button" checked>3</input>
          <input type="radio" name="rating" value="4" class="user-rating-button" checked>4</input>
          <input type="radio" name="rating" value="5" class="user-rating-button" checked>5</input>
          <button type="submit"> Submit</button>
        </form>
      </main>
    </div>
    

    I think this would be a more semantic and cleaner solution.

    Pro tips 💪🤓:

    • Less code means better results.
    • When coding, embrace a team mentality. Comment your files, format your code consistently, create a descriptive README, and write semantic, understandable code, etc.
    • Always keep an open mind.

    Overall, your solution looks fantastic and works smoothly. You're on the right path. I hope these tips will help you improve as a developer.

    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
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.

Oops! 😬

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

Log in with GitHub