Dynamic FAQ Accordion with Search & Accessibility
Phonepe's support portal requires a robust and accessible FAQ section to help users quickly find answers to common queries. This section needs to be dynamic, allowing for easy updates and an intuitive user experience. Your task is to build a highly interactive and performant accordion component that supports search functionality and adheres to modern accessibility standards.
FAQAccordion component:
question (string) and answer (string).allowMultipleOpen (boolean, default false) to enable multi-select mode, where multiple FAQ items can be open simultaneously.question and answer (case-insensitive).question or answer matches the search query, it should be displayed. If no query, all items are displayed.aria-expanded, aria-controls, aria-labelledby, role="region", hidden).Tab key should move focus between accordion headers.Space or Enter key on a header should toggle its expanded state.Up/Down arrow keys should navigate focus between accordion headers within the accordion.Home and End keys should move focus to the first and last accordion headers, respectively.FAQAccordion component renders all provided FAQ items initially.allowMultipleOpen prop, multiple items can be open simultaneously.aria-expanded and aria-controls attributes correctly applied and updated.id, role="region", and aria-labelledby attributes correctly applied, and hidden attribute toggles with state.Tab, Enter, Space, Up/Down arrows, Home, End) functions as specified, moving focus between headers and toggling state.Constraints
FAQAccordion component is structured, its props, state management, and separation of concerns.Loading editor...