Skip to content

Faq page fix#84

Open
dikshajha13 wants to merge 4 commits into
kunalverma2512:mainfrom
dikshajha13:faq-fix
Open

Faq page fix#84
dikshajha13 wants to merge 4 commits into
kunalverma2512:mainfrom
dikshajha13:faq-fix

Conversation

@dikshajha13
Copy link
Copy Markdown

@dikshajha13 dikshajha13 commented May 21, 2026

Description

This PR adds a new FAQ section to the CodeLens Explore page and improves the existing FAQ component in App.jsx integration. The FAQ is organized into categories (General, Tools, Contests, Dashboard) and provides an interactive accordion-style UI for better user understanding of the platform.
It also includes improvements to routing and minor UI updates for better structure and maintainability.

Changes made

Added categorized FAQ data with interactive accordion UI
Integrated FAQ section into Explore flow
Improved FAQ category switching and state handling
Updated routing to include /faq page
Minor fixes and cleanup in App.jsx

UI design Screenshots

Screenshot 2026-05-21 at 1 21 33 AM Screenshot 2026-05-21 at 1 21 43 AM Screenshot 2026-05-21 at 1 21 59 AM

Summary by CodeRabbit

  • New Features
    • Launched a new FAQ page accessible via /faq with categorized questions
    • FAQs organized into four categories: General, Tools, Contests, and Dashboard
    • Interactive accordion interface to expand and collapse individual answers
    • Full keyboard accessibility support for navigating and interacting with FAQ items

Review Change Stack

@github-actions
Copy link
Copy Markdown

🚀 PR Received Successfully

Hello @dikshajha13,

Thank you for taking the initiative to contribute to this project.

Please ensure that your PR follows all project guidelines properly before requesting review.

⚠️ Important Instructions

  • Maintain proper code quality and structure
  • Do not make unnecessary changes/files
  • Ensure responsiveness across devices
  • Follow existing project conventions strictly
  • Attach screenshots/videos for UI-related changes
  • Resolve merge conflicts before requesting review
  • Avoid AI-generated low quality PRs or copied implementations

📌 Mandatory for GSSoC'26 Participants

Joining the community group and announcement channel is compulsory for all contributors participating through GSSoC'26.

Failure to follow contribution guidelines may lead to PR rejection.

We appreciate your effort and wish you a great open-source journey ahead. ✨

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

A new FAQ page component is added with category-based filtering and accordion-style expandable items, keyboard accessibility support, and integration into the application routing at /faq.

Changes

FAQ Page Feature

Layer / File(s) Summary
FAQ Data Structure and Component Setup
frontend/src/pages/FAQpage.jsx
Static faq_data array contains FAQ objects grouped by category (GENERAL, TOOLS, CONTESTS, DASHBOARD); FAQpage component initializes state for selectedCategory (default "GENERAL") and openQuestion (initially null) to manage filtering and expand/collapse.
Category Filtering and FAQ Rendering with Accessibility
frontend/src/pages/FAQpage.jsx
Category buttons update the selected category and reset open question state; FAQ list maps filtered items with click handlers and keyboard accessibility via role="button", tabIndex={0}, and onKeyDown for Enter/space key to toggle answer visibility.
Route Integration in App
frontend/src/App.jsx
FAQ import switched from FAQSection to FAQpage; new <Route path="/faq"> added to render the FAQpage component; minor whitespace adjusted around routes block.

Sequence Diagram

sequenceDiagram
  participant User
  participant CategoryButton
  participant FAQItem
  User->>CategoryButton: Click category button
  CategoryButton->>CategoryButton: Update selectedCategory
  CategoryButton->>FAQItem: Filter and render items
  User->>FAQItem: Click or press Enter/Space
  FAQItem->>FAQItem: Toggle expanded state
  FAQItem->>FAQItem: Conditionally render answer
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • kunalverma2512/CodeLens#65: Adds a "View All FAQs" CTA in FAQSection that links to /faq, complementing this PR's new FAQ page route and component.

Suggested labels

enhancement, Frontend, UI/UX, quality:clean

Poem

🐰 A curious rabbit hops with glee,
To find those questions answered free,
With buttons sorted, clean and bright,
FAQ pages feel just right!
Press your space, expand with care,
The answers bloom everywhere! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Faq page fix' is vague and generic; it uses a non-descriptive term 'fix' without explaining what was actually fixed or what the main change is. Use a more descriptive title that clearly indicates the main change, such as 'Add FAQ page component with categorized questions and accordion UI' or 'Implement FAQ page with category filtering and keyboard accessibility'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/pages/FAQpage.jsx (1)

157-181: ⚡ Quick win

Expose expanded/collapsed state for screen readers.

The accordion trigger currently lacks aria-expanded and aria-controls, so assistive tech users don’t get clear state/context feedback.

Suggested fix
             <div
                 role="button"
                 tabIndex={0}
+                aria-expanded={openQuestion === index}
+                aria-controls={`${item.category}-${index}-content`}
                 onKeyDown={(e)=>{
                     if(e.key === "Enter" || e.key === " "){
                         setOpenQuestion(openQuestion===index?null:index);
                     }
                 }}
             >
@@
-                        {openQuestion ===index &&(
-                            <p className="mt-3 text-gray-600 dark:text-gray-300">
+                        {openQuestion ===index &&(
+                            <p id={`${item.category}-${index}-content`} className="mt-3 text-gray-600 dark:text-gray-300">
                             {item.answer}
                         </p>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQpage.jsx` around lines 157 - 181, The clickable FAQ
accordion div (role="button" with onKeyDown) does not expose its expanded state
or link to the content for screen readers; update the trigger to include an
aria-expanded attribute set to a boolean expression (e.g.
aria-expanded={openQuestion===index}) and add aria-controls referencing a unique
id for the answer pane (generate id using index or item id), and ensure the
answer paragraph rendered by the condition has that id (e.g.
id={`faq-answer-${index}`}) so assistive tech can associate the control with its
region; keep existing behavior using setOpenQuestion and openQuestion for state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/FAQpage.jsx`:
- Around line 157-165: The onKeyDown handler for the accordion toggling (the
inline function that checks e.key === "Enter" || e.key === " ") should call
e.preventDefault() when the Space key is pressed (and optionally for Enter)
before calling setOpenQuestion(openQuestion===index?null:index) to stop the
browser from scrolling; update the handler attached to the div (the
role="button" block) to prevent default on space and then perform the toggle
using the existing setOpenQuestion/openQuestion/index logic.

---

Nitpick comments:
In `@frontend/src/pages/FAQpage.jsx`:
- Around line 157-181: The clickable FAQ accordion div (role="button" with
onKeyDown) does not expose its expanded state or link to the content for screen
readers; update the trigger to include an aria-expanded attribute set to a
boolean expression (e.g. aria-expanded={openQuestion===index}) and add
aria-controls referencing a unique id for the answer pane (generate id using
index or item id), and ensure the answer paragraph rendered by the condition has
that id (e.g. id={`faq-answer-${index}`}) so assistive tech can associate the
control with its region; keep existing behavior using setOpenQuestion and
openQuestion for state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7198547e-4c9f-4ce3-8422-db97b80741d7

📥 Commits

Reviewing files that changed from the base of the PR and between 47f72c6 and 662294b.

⛔ Files ignored due to path filters (2)
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • frontend/src/App.jsx
  • frontend/src/pages/FAQpage.jsx

Comment on lines +157 to +165
<div
role="button"
tabIndex={0}
onKeyDown={(e)=>{
if(e.key === "Enter" || e.key === " "){
setOpenQuestion(openQuestion===index?null:index);
}
}}
>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Prevent page scroll when toggling with Space key.

On Line 161, space key toggles the accordion but does not prevent default scrolling behavior, which can cause a jarring keyboard UX.

Suggested fix
             <div
                 role="button"
                 tabIndex={0}
                 onKeyDown={(e)=>{
                     if(e.key === "Enter" || e.key === " "){
+                        e.preventDefault();
                         setOpenQuestion(openQuestion===index?null:index);
                     }
                 }}
             >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
role="button"
tabIndex={0}
onKeyDown={(e)=>{
if(e.key === "Enter" || e.key === " "){
setOpenQuestion(openQuestion===index?null:index);
}
}}
>
<div
role="button"
tabIndex={0}
onKeyDown={(e)=>{
if(e.key === "Enter" || e.key === " "){
e.preventDefault();
setOpenQuestion(openQuestion===index?null:index);
}
}}
>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/FAQpage.jsx` around lines 157 - 165, The onKeyDown handler
for the accordion toggling (the inline function that checks e.key === "Enter" ||
e.key === " ") should call e.preventDefault() when the Space key is pressed (and
optionally for Enter) before calling
setOpenQuestion(openQuestion===index?null:index) to stop the browser from
scrolling; update the handler attached to the div (the role="button" block) to
prevent default on space and then perform the toggle using the existing
setOpenQuestion/openQuestion/index logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant