SASS + Vanilla Javascript FAQ Accordion Card Solution
Design comparison
Solution retrospective
Hello, everyone!
This is my solution to the FAQ accordion card challenge. What do you think?
Thanks!
Community feedback
- @elidrissidevPosted about 3 years ago
Hey Felipe, great work on this solution!
Here are my suggestions:
- Just in case you don't know, you can build the whole accordion without a single line of JavaScript using
<\details\>
and\<summary\>
elements. - The way you've built the accordion works perfectly. Here's a good read about creating accessible accordions
Good luck, and keep it up!
Marked as helpful0@flp-pcllPosted about 3 years ago@elidrissidev Thank you, Mohamed! This link with the Acessibility Guidelines will be very helpful to improve my html markup because this is a point in which i always get confused.
I had read about building the accordion component only with html when i got stuck with the arrow-icon part (i was working with the <svg> so the event.target was a mess between the <svg> and <path>) but i decided to stick with the initial plan to make it work, but i will definetly make use of the <details> tag to see how it works!
0@elidrissidevPosted about 3 years ago@flp-pcll You can use
pointer-events: none
on the<svg>
and it will prevent it from becoming theevent.target
even when it's clicked! Hope that saves you the headache like It did for me πMarked as helpful0 - Just in case you don't know, you can build the whole accordion without a single line of JavaScript using
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