Rating component solution using HTML, CSS Flexbox and JS
Design comparison
Solution retrospective
I made all the buttons flash orange, if user tries to submit without rating.
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
HEADINGS ⚠️:
- This solution consists incorrect usage of
<h1>
so it can cause severe accessibility errors due to incorrect usage of level-one headings<h1>
- Every site must want only one
h1
element identifying and describing the main content of the page.
- An
h1
heading provides an important navigation point for users of assistive technologies, allowing them to easily find the main content of the page.
- In this solution there's
<h1>
element which is this<h1>How did we do?</h1>
, you can preferably use<h2>
instead of<h1>
. Remember<h1>
provides an important navigation point for users of assistive technologies so we want to use it wisely
- So we want to add a level-one heading to improve accessibility by reading aloud the heading by screen readers, you can achieve this by adding a
sr-only
class to hide it from visual users (it will be useful for visually impaired users)
- Example:
<h1 class="sr-only">Interactive rating component</h1>
- If you have any questions or need further clarification, you can always check out
my submission
for another challenge where i used this technique and feel free to reach out to me.
OVERLFOW 📐:
- Use
overflow: hidden
forbody
may result in the component being cut off on smaller screens such as mobile devices in landscape orientation
- So avoid it hereafter to prevent this issue
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1@PauliMaenpaaPosted over 1 year ago@0xAbdulKhalid Hi! First time hearing about sr-only class. Glad u brought it up. I will keep it in my mind while working on my next project.
0 - @j0sephh123Posted over 1 year ago
Feedback: Great work so far! Your HTML structure is clean and well-organized, and your JavaScript code is easy to follow. Keep it up! I noticed a few areas where we can improve the consistency of your styling:
CSS units: It seems like you're using both pixels and rems in your code. To maintain consistency, I would suggest choosing one and sticking to it throughout your project. I personally prefer using rems, as they can provide a better responsive design.
Colors: Nice job defining CSS variables for colors! Just a quick note - there are still some instances of hard-coded colors in your code. To keep everything consistent and easy to manage, try to use the defined variables instead of hard coding the colors.
Duplicate classes: I noticed that you have two classes with the same styling: rating-container and submit-container. You could probably create a more generic class like flex-container or similar to consolidate these styles and reduce redundancy.
Repository: Looking at your GitHub repository, it would be a good idea to add a short README to explain what the code does and how to run it. This will make it easier for others to understand your project and contribute.
Marked as helpful1@PauliMaenpaaPosted over 1 year ago@j0sephh123 Thank you for the feedback! I will look in to your suggestions and make the improvements (Y)
0
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