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 solution

#sass/scss
Kenβ€’ 140

@kenneth0417

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Any feedback please on how can I improve in design.

Community feedback

P
Alexβ€’ 1,990

@AlexKMarshall

Posted

Hey there, this looks good, and is nice and responsive on smaller screens.

However, it's not a very accessible implementation. Try to use this with a keyboard and you'll see what I mean.

The reason this doesn't work with a keyboard is that you've used non-interactive elements for things that a user is supposed to do things with. The rating buttons are just <li> elements here. This means you have to add extra javascript to handle interactions, and it's very easy to miss all the things needed to make this work with keyboards, screen-readers etc.

The easy fix for this is to make those ratings radio buttons instead. Something like:

<fieldset>
  <label>
    <input type="radio" name="rating-group" value="1"/>
    <span>1</span>
  </label>
  <label>
    <input type="radio" name="rating-group" value="2"/>
    <span>2</span>
  </label>
  etc
</fieldset>

By doing that you'll get built-in keyboard support. And you won't have to do stuff in the javascript to style them as you can get which button has the :checked state directly in the CSS.

Marked as helpful

3

Kenβ€’ 140

@kenneth0417

Posted

@AlexKMarshall Very much appreciated on your feedback! I'll try to implement it on my further projects. Thank you.

0

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