@VCarames
Posted
Congrats on complete this challenge and welcome back! 🎊🎆🍻 (Been a while since your last submit).
Beautiful design like always! 😍
Here are some suggestions:
- To ensure that the "rating buttons" are fully accessible 💯, they need to be built using a
form
⚠️ (along with alegend
) and inside of it, there should be fiveinput radios
and eachinput
should have alabel
attached to it to make the buttons accessible. Wrap all theinputs
andlabels
inside afieldset
to prevent users from making more than one selection. Lastly, abutton
will be the last thing before closing theform
.
More Info: 📚
- Once the top is implemented , for your JS, the
eventListener
should be on theform
⚠️ as asubmit
.
More Info:📚
Click vs. Submit EventListeners
- To get the ‘rating’ ⚠️ you would use
const rating = form. querySelector (" input [type= 'radio']: checked")
- ⚠️ Do not forget to convert you CSS units to relative units.
Happy Coding! 🎆🎊🪅
Marked as helpful
@correlucas
Posted
@vcarames Thank you! I'll apply these changes soon.
@correlucas 100% this advice above is essential for the challenge.
It's a html form and you should be listening for the submit event. Theres really no other corect way for this one.
You also need to remove the articles from this. You're misusing the element. It cannot be used to break up related content. Articles have a specific semantic meaning for encapsulating content that can be syndicated on other pages or sites. It is not a general element to group small bits of layout together.
Once you've fixed the html, you will need to change your js. You should be learning to work with the form data.
Another accessibility point. If you are going to change the design, that's fibe to do but you must not make it less accessible. I can't read the button or selected states on this because of the white on light green.
With modals there is now a dialog element for that purpose. They have specific accessibility challenges around focus management that I'm not going to go into in detail, but again it's important to only use them once you understand these requirements and how to address them. It's a nice idea but not correctly implemented at the moment.
My general advice is to keep things simple. Work through the challenges in their simplest way first, focusing on code quality. Then if you want to extend later you can do that once you know a solid foundations been laid.
Other advice is to consider semantics and accessibility at every stage. It's so important and you can't afford to leave learning it until later. Think about keyboard, screen magnification, vision impairment and screenreaders as a minimum. If you do, you'll become a truly excellent developer.
Good luck
Marked as helpful
@correlucas
Posted
@grace-snow Hey Grace, thank you for the feedback!
-
About the article, in this case I wrap everything inside a main/div and that's fine?
-
I've really few knowledge in JS, I am following a course and I wanted to try this challenge, but since I didn't knew yet how to work with forms I tried to make the challenge in the other way (I didn't knew the only to do it was using forms). I'll do the challenge again using the rating buttons and submit using a form/radial buttons instead of using a list of buttons.
-
I'll pay more attention to these design/accessibility details. I wasn't aware of that.
Anyway, thank you a lot, next time a face an challenge like that I'll use a form instead of trying something else 😁
Thanks =)
@correlucas
Posted
@vcarames Hey bro I updated my code, here's the live site https://relaxed-phoenix-dd38fe.netlify.app/
@correlucas
Posted
@grace-snow I updated my JS code =)
@VCarames
Posted
@correlucas
Nice job implementing the radio inputs
! Do not forget to add the legend
inside the form
(it should visually hidden and state something like, "Please select a rating…")
For the “thank you” content, you’ll need to announce the changes to your content when it appears to screen readers.
So you’ll need to wrap the entire “thank you” content in a an div
and give it an aria-live="polite"
(there should be nothing else on this div
).
More Info: 📚
You were going on the right direction here in your JS;
// form.addEventListener("submit", (ev) => {
// ev.preventDefault()
// output.classList.remove('hidden');
// input.classList.add('hidden');
// })
It should be something like this;
form. addEventListener ("submit", (e) => {
e.preventDefault ( );
const rating = document.querySelector ("input [type= 'radio': checked").value;
userselection.textContent = 'You selected ${rating} out of 5;
Remove/add classes/attributes
});
Besides the modal (I haven’t studied them yet), your HTML should be good to go.
Marked as helpful
@correlucas
Posted
@vcarames Hey bro! Thank you again for the feedback, was really useful the info you gave me. May I ask you where did you learn this stuff about the html/accessibility and JS?
The JS part I had a hard time trying to understand it, so I'll study a little bit more my course to try it again soon.
Anyway, thank you a lot!
@VCarames
Posted
@correlucas
I’m glad I was able to help you out.
Honestly, I just read as much as I can on Google, https://developer.mozilla.org/en-US/ and https://dev.to/ (I made it a habit every morning after the gym) and then try implementing whatever it is I’m trying to build as best I can. If I’m stuck or have any hesitations (if I can’t find an "answer’ online) I will ask on the Slack channel’s #help, you’ll get more feedback there than on the FEM site.
For HTML, https://developer.mozilla.org/en-US/ is my go to for pretty much everything related to HTML (you’ll notice that it is the main source I give everyone in my comments); it is a gold mine! Not only does it show you the HTML code it also shows you how to use JS with the HTML code. That’s how I learned about the form
element and the radio inputs
.
For the accessibility, I began placing more emphasis on this when it comes to my web development. So when I Google something, I always include the text "accessible". This helps filter out anything that is non-accessible. And my go to site is https://www.w3.org/WAI/ it has everything regarding accessible web development.
Also by the end of the month Grace (she’s the queen of accessibility) will be releasing her own site regarding accessible web development https://fedmentor.dev/ so I recommend signing up for her newsletter.
For the JS, I know how you feel. It took me a while to understand how it worked. I ended up taking this Udemy course last year on August, https://www.udemy.com/course/the-complete-javascript-course/, unfortunately, I didn’t finish it 100%.
Once I understood the basics I stopped watching and began implementing my own JS code. But I try to keep it simple as possible (the less code the better). I use HTML and CSS as much as I can and only use JS when needed.
Hopefully that helps.