@0xabdulkhaliq
Posted
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have a suggestion regarding your code that I believe will be of great interest to you.
MAKING RATING FORM ACCESSIBLE :
- Currently the rating form is not accessible for keyboard devices, It will cause navigating issues for rating radio buttons. it's because the lack of
fieldset
element and the way you wrappedinput
element usinglabel
. Don't do that instead you use adiv
to wrap them up.
- The resulted markup will look like this,
<form>
<fieldset>
<legend class="sr-only">Please select a rating</legend>
<div>
<input type="radio" name="rating" id="rating-1" value="1">
<label for="rating-1">1</label>
</div>
<div>
<input type="radio" name="rating" id="rating-2" value="2">
<label for="rating-2">2</label>
</div>
....
</fieldset>
<button type="submit">
Submit
</button>
</form>
- I would highly recommend you to check out
my submission
for this challenge, So that you could figure out how built this rating component in an inclusive way to prevent accessibility issues.
- If you have any questions or need further clarification then feel free to reach out to me.
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful
@takinabradley
Posted
@0xabdulkhalid
Adding the fieldset and legend is a good idea that I honestly forgot to think about. It's nice to add some extra directions there. Thanks!
I already did test this with a screen-reader, and it works well. As far as I know, nesting inputs within labels is a valid alternative!