FAQ accordion card (only mobile screens)
Design comparison
Solution retrospective
Hi there π, Iβm Danil and this is my solution for this challenge. π
β‘ Performance:
90%-100% on lighthouse report and PageSpeed Insights. π
π οΈ Built With:
- Semantic HTML5 markup βοΈ
- Flexbox βοΈ
- Mobile-first workflow βοΈ
π¨βπ» Languages Used:
- HTML βοΈ
- CSS (Vanilla) π¨
- JavaScript (Vanilla) β¨
- TypeScript (Vanilla) π
Any suggestions on how I can improve and reduce unnecessary code are welcome!
Thank you. π₯
Community feedback
- @grace-snowPosted over 1 year ago
It doesn't look like youβve done the large screen version of the design. was that intentional?
iβm afraid this is not accessible because youβve not used correct HTML. You must use interactive elements for interactive behaviour. This needs buttons with aria expanded on them toggling on click. In fact you could do everything else in css, that is all that is needed on this challenge.
Ideally, accordions like this should have a no js fallback. Usually that means they are shown as expanded by default, but as soon as the js loads all become collapsed and interactive. Not essential for this challenge but necessary when this UI is used in production
Marked as helpful1@Rock-n-Roll-CRCPosted over 1 year agoI don't really get it...
If I need to replace my elements with interactions set on them with buttons, then people with no disabilities will see a different design. How does this work?
For example, my current design is with interactive
h3
andimg
do I need to replace them with buttons or something? In that case, the design would be horrible for people with no disabilities...@grace-snow
0@grace-snowPosted over 1 year ago@Rock-n-Roll-CRC the design stays exactly as it is. But you must use the correct html
That means buttons for this (you can style them however you like) with aria-expanded attributes that toggle between false and true on click - that communicateds state. When I say that's all you need I mean you can use the aria-expanded value as the styling hook to apply the open or closed styles
This is called a disclosure ui or expandable content
Alternatively for a purely html version (no js) you can use the details summary elements
It is essential to use interactive elements for interactive behaviour so that solutions work for ALL people (eg including keyboard, screenreader users, switch control users, or voice control users etc)
Marked as helpful1
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