Submitted almost 3 years ago
Responsive FAq accordion card html css and js
@Starisblack
Design comparison
SolutionDesign
Solution retrospective
suggestions are welcome
Community feedback
- @vanzasetiaPosted almost 3 years ago
๐ Hi Samuel!
๐ Congratulations on finishing this challenge! I have some feedback on this solution:
- Accessibility
- For the accordion, I would recommend using
details
andsummary
elements (accessible by default). If you are planning to keep usingbutton
element then I would recommend searching How to make accessible accordion?. - The
footer
element should live outside themain
element. - For any decorative images, each
img
tag should have emptyalt=""
andaria-hidden="true"
attributes to make all web assistive technologies such as screen reader ignore those images. In this case, all images are decorative only.
- For the accordion, I would recommend using
- Styling
- The
h1
is not centered on mobile view. - There's too much
padding-bottom
on thebody
element.
- The
- JavaScript
- I would recommend using
const
orlet
instead ofvar
.var
is known to have a problem with scooping. - Use
forEach
instead offor loop
. By doing that, it will make you write more readable and modern code. - For better user experience, I would recommend creating a
function
that will close the opened accordion every time the user wants to open another accordion. it simply only allows one accordion to be open at a time.
- I would recommend using
- Best Practice (Recommended)
- I would recommend writing the styling using mobile-first approach. It often makes me write less code.
That's it! Hopefully, this is helpful!
Marked as helpful0 - Accessibility
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