Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 month ago

🛑Faq-section

accessibility, jss, pure-css
Piyush Rajput•270
@Piyush-Rajput7
A solution to the FAQ accordion challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

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)?

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community 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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License