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

Interactive Rating Component using HTML/SCSS/JS

#sass/scss
Vanessaโ€ข 190

@Reallyvane

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

P

@christopher-adolphe

Posted

Hi @Reallyvane ๐Ÿ‘‹

You did a great job in completing this challenge. ๐Ÿ‘ The component is faithful to the design. ๐Ÿ‘Œ Below are a few things that I have noticed and you might want to check in order to improve your solution.

  • When I look at this component, I would expect to see a <form> element with <input type="radio"/> elements for the different ratings and a submit <button> in the HTML markup. However, it is not the case in your solution. While the component seem to be working fine for the general users, those with assistive technology might struggle to interact with it. This is why I would suggest you to use HTML elements that are built to take user inputs when it is the case. For example <input type="radio"/> or <input type="checkbox"/> to choose from a list of options instead of <div> elements. This will also simplify things on the JavaScript side. ๐Ÿ˜‰
  • I also noticed that you have set a default rating value of 3 but at the moment, there is no visual cue that communicates that to the user. You should add the active class by default on the corresponding <div class="rating-btn"> element. Again, if it was a <input type="radio"/>, you would have used the checked attribute to achieve that. On the other hand, if you don't wish to set a default rating value, you would then have to add a check in the onSubmit() function like this:
let stars_score;

function onSubmit() {
  // Returning early if stars_score is not set
  if (!stars_score) {
    return;
  }
  
  card_content_1.classList.add("hide");
  score.textContent = stars_score;
  card_content_2.classList.remove("hide");
}

I hope this helps.

Keep it up.

Marked as helpful

1

Vanessaโ€ข 190

@Reallyvane

Posted

Hi!

Thank you so much. This helps a lot and I appreciate the thorough explanation and example.

0
P

@christopher-adolphe

Posted

I'm happy to help and glad to see this was helpful to you. ๐Ÿ™‚

See you on the next one.

Best regards.

0
Stevecmdโ€ข 100

@Stevecmd

Posted

Good job on the project, you kept it nice and simple! To enable people learn from you, perhaps you could include more comments to explain what each segment of code is doing. The project is responsive and is quite similar to the solution.

Marked as helpful

0

Vanessaโ€ข 190

@Reallyvane

Posted

Hi!

Thatโ€™s a great idea! Iโ€™ll work on leaving more comments. Thank you so much for the feedback.

0
Danilo Blasโ€ข 6,300

@Sdann26

Posted

Hi Vanessa!

Just a detail, using JS I would recommend that you can prevent the page from reloading if the user clicks SUBMIT if he/she has not chosen any option.

For everything else I congratulate you is well done both design and responsive and the rest of the functionality.

Good luck!

Marked as helpful

0

Vanessaโ€ข 190

@Reallyvane

Posted

Hi!

If you have time can you explain how I can add that feature. But, thank you so much for you feedback itโ€™s truly appreciated.

Thank you!

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