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

Interactive Rating Component - Vanilla JS, CUBE CSS, accessibility

accessibility, cube-css
Adam Wozniak•230
@adamwozhere
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


With this project I have tried to keep accessibility in mind; although I'm unsure if it is the correct / ideal implementation. The select buttons are a part of a fieldset with role="radiogroup" and a legend that is visually hidden. As the card is a form, I included error checking so that if the form is submitted without selecting a rating, then an error message is displayed. I have not looked into fully checking accessibility but I think that the error message would be announced when using a screenreader because of the role="alert" attribute:

<strong class="alert" id="error-msg" role="alert" hidden>Select a rating from 1 to 5</strong>

This seems like a sensible solution as it means the error message is styled to match the card rather than being a browser-styled popup as with other form inputs / elements.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Adam Wozniak's solution.

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