🛑Faq-section

Solution retrospective
I'm proud of implementing full accessibility support using semantic HTML and ARIA attributes (aria-expanded, aria-controls) to make the FAQ accordion usable for screen reader and keyboard users. I also kept the JavaScript logic clean and reusable for multiple accordion items.
If I did this again, I would consider making the accordion more scalable by dynamically generating content through JavaScript or rendering it with a frontend framework like React to practice component-based architecture.
🧠What challenges did you encounter, and how did you overcome them? One major challenge was understanding how aria-expanded and aria-controls work together to toggle content while maintaining accessibility. I initially struggled with keeping the accordion state consistent and screen-reader friendly, especially during toggling and keyboard navigation.
To overcome this, I studied WAI-ARIA guidelines and inspected similar implementations. I also tested the behavior using keyboard-only interaction and screen reader tools to ensure it worked as expected.
What challenges did you encounter, and how did you overcome them?One major challenge was understanding how aria-expanded and aria-controls work together to toggle content while maintaining accessibility. I initially struggled with keeping the accordion state consistent and screen-reader friendly, especially during toggling and keyboard navigation.
To overcome this, I studied WAI-ARIA guidelines and inspected similar implementations. I also tested the behavior using keyboard-only interaction and screen reader tools to ensure it worked as expected.
What specific areas of your project would you like help with?Could someone review how I manage the aria-expanded state and whether there’s a better pattern for updating DOM attributes cleanly?
Is my approach to hiding/showing answers (element.hidden = true/false) optimal for accessibility, or is there a more semantic method?
Any tips for improving the keyboard accessibility further (e.g., arrow key support or accessibility roles)?
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Piyush Rajput's solution.
Join 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