Skip to content

Conversation

@anurag2787
Copy link
Contributor

Resolves #2036

Description:

This PRs changes the ToggleableList component so that buttons no longer show an underline or transition effects when hovered only the background color changes and adds corresponding tests to ensure this behavior.

Checklist

  • I've read and followed the contributing guidelines.
  • I've run make check-test locally; all checks and tests passed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Summary by CodeRabbit

  • Style

    • Simplified ToggleableList item appearance by removing hover animations and underline effects.
    • Retained a subtle hover background for clearer, more consistent interaction feedback.
    • Improved visual consistency across light and dark themes.
  • Tests

    • Updated unit tests to reflect the revised styling, ensuring items no longer include animation or underline classes and only apply the hover background behavior.

Walkthrough

Removes transition/underline hover styles from ToggleableList item buttons and updates the corresponding unit test to assert only hover background changes. No logic or API changes.

Changes

Cohort / File(s) Summary
Component hover styling update
frontend/src/components/ToggleableList.tsx
Removed transition and underline classes from item button; retained base and hover background classes.
Unit test update
frontend/__tests__/unit/components/ToggleableList.test.tsx
Adjusted expectations to exclude transition/underline classes and verify only hover background classes; added negative assertions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove underline and transition effects from ToggleableList item hover state (#2036)
Ensure hover state only changes background (#2036)
Update/add tests for new hover behavior (#2036)

Possibly related PRs

Suggested labels

frontend, frontend-tests

Suggested reviewers

  • arkid15r
  • kasya
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (3)
frontend/src/components/ToggleableList.tsx (2)

38-41: Add type="button" to be explicit and avoid accidental form submission

Defensive best practice; prevents this button from becoming a form submitter if the component is ever embedded in a form.

Apply this diff:

           <button
             key={index}
+            type="button"
             className="rounded-lg border border-gray-400 px-3 py-1 text-sm hover:bg-gray-200 dark:border-gray-300 dark:hover:bg-gray-700"
             onClick={() => handleButtonClick({ item })}

40-40: Optional a11y: consider adding focus-visible ring

To aid keyboard users without introducing transitions, consider focus-visible utilities, e.g.:

Add to className (example):

  • focus-visible:outline-none
  • focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400
  • dark:focus-visible:ring-gray-500

This keeps hover behavior per spec while improving focus indication.

frontend/__tests__/unit/components/ToggleableList.test.tsx (1)

172-193: Optional: query by role and add a generic guard for transitions

Minor resilience improvements:

  • Prefer getByRole('button', { name: 'React' }) for accessibility-aligned querying.
  • Add a generic assertion to catch any future transition utilities, e.g.:
expect(button.className).not.toMatch(/\b(transition|duration|ease|transform|scale-)\b/)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e137c07 and 564db40.

📒 Files selected for processing (2)
  • frontend/__tests__/unit/components/ToggleableList.test.tsx (2 hunks)
  • frontend/src/components/ToggleableList.tsx (1 hunks)
🔇 Additional comments (2)
frontend/src/components/ToggleableList.tsx (1)

40-40: Hover underline/transition removed as requested — LGTM

Matches #2036: no underline, no scaling/transition; only background changes on hover (including dark mode). Behavior and API unaffected.

frontend/__tests__/unit/components/ToggleableList.test.tsx (1)

172-193: Tests correctly assert the new styling contract

Positive checks for expected classes and explicit negatives for underline/transition/scale confirm the intended hover-only background behavior. Good alignment with component changes.

@sonarqubecloud
Copy link

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

Thanks for updating this! 👍🏼

@kasya kasya enabled auto-merge August 12, 2025 05:32
@kasya kasya added this pull request to the merge queue Aug 12, 2025
Merged via the queue into OWASP:main with commit 9df6fae Aug 12, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update ToggleableList hover state

2 participants