Design comparison
Community feedback
- @VCaramesPosted about 2 years ago
Hey there! 👋 Here are some suggestions to help improve your code:
-
Change
width
tomax-width
in your component’s container to make it responsive. You will also want to delete theheight
as it is unnecessary. -
The “icons/images” in this component serve no other purpose then to be decorative; They add no value. There
Alt Tag
should be left blank and have anaria-hidden=“true”
to hide them from assistive technology.
https://www.w3.org/WAI/tutorials/images/
- The proper way to build this challenge is to create a
Form
and inside of it, the “rating buttons” should be built using anInput Radio
(wrap all of them inside aFieldset
), since this will prevent additional buttons from being active at the same time, and it should have aLabel
element attached to it for accessibility.
MDN <fieldset>: The Field Set element
-
Your buttons need to have an
active
state to let users know which button they selected. -
Your button, currently allows users to submit without selecting a rating. This can solved by doing one of the following:
- Disable the button until a selection is made.
- Make the rating 5 the default rating.
- Add an error message when a rating is not seleted.
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! 🍂🦃
Marked as helpful0 -
- @avinashdvPosted about 2 years ago
Hi @natalie-0073 I see that you haven't registered a click event in any of the ratings. They should be clickable and when the user click's on any rating, it should be stored in a variable. Upon clicking the submit button the value stored in the variable should be used to show the rating on "Thank you" Card.
I've written on plain JS using event-delegation. Have a look to get some idea. Repo: https://github.com/avinashdv/interactive-rating
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin 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