Skip to content

Comments

Fixed inconsistent UI of clear search icon across all search bars#2866

Merged
kasya merged 11 commits intoOWASP:mainfrom
anirudhprmar:fix/inconsistent-ui
Dec 13, 2025
Merged

Fixed inconsistent UI of clear search icon across all search bars#2866
kasya merged 11 commits intoOWASP:mainfrom
anirudhprmar:fix/inconsistent-ui

Conversation

@anirudhprmar
Copy link
Contributor

Proposed change

Resolves #2849

This PR fixed inconsistencies in UI of clear search icon across all the search bars which support both themes.

changes made:

  • fixed for search bar for projects and contributions page
  • fixed for home page

for home page:

dark mode:
screenshot-2025-12-11_16-31-33

light mode:
screenshot-2025-12-11_16-31-50

for projects and contributions page:

dark mode:
screenshot-2025-12-11_16-36-45

light mode:
screenshot-2025-12-11_16-36-25

Checklist

  • I read and followed the contributing guidelines
  • I ran make check-test locally and all tests passed
  • [ ] I used AI for code, documentation, or tests in this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Summary by CodeRabbit

  • Style
    • Updated Clear button visuals across search interfaces: standardized size and shape, refined text and background colors, added richer hover, focus and dark-mode styling for clearer feedback and a more consistent look and feel. No changes to button behavior or interactions.
  • Tests
    • Updated unit tests to align with the revised Clear button styling.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Updated Tailwind CSS classes for the clear-search buttons in two frontend components and their unit test; only styling/className changes were made (dimensions, hover/focus and dark-mode styles). No functional, event-handling, or exported API changes.

Changes

Cohort / File(s) Summary
Clear search button styling updates
frontend/src/components/MultiSearch.tsx, frontend/src/components/Search.tsx, frontend/__tests__/unit/components/Search.test.tsx
Replaced/added Tailwind classes to set explicit size (h-8 w-8), shape (rounded-md), text color (text-gray-400), hover states (hover:bg-gray-400, hover:text-gray-200), focus ring (focus:ring-2 focus:ring-gray-300, focus:outline-hidden) and dark-mode hover (dark:hover:bg-gray-600). Tests updated to match new class strings. No JS logic changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Homogeneous, cosmetic/styling changes across components and tests.
  • Spot-checks recommended:
    • Confirm type="button" and ARIA attributes remain present where applicable.
    • Verify icon color/contrast on hover in light and dark themes.
    • Ensure updated test assertions exactly match rendered classNames.

Possibly related PRs

Suggested reviewers

  • arkid15r

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: fixing UI inconsistencies in clear search icons across search bars.
Description check ✅ Passed The description is well-related to the changeset, explaining the UI fix for clear search icons, identifying affected components (home page, projects/contributions page), and providing visual evidence.
Linked Issues check ✅ Passed The PR addresses issue #2849 by updating button styling (rounded-md, size h-8 w-8, hover/focus states, dark mode support) to make the clear-search icon visually consistent across components.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the clear-search icon UI inconsistencies: component styling updates and corresponding test updates align with issue #2849 scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4f3fe0 and ce83897.

📒 Files selected for processing (3)
  • frontend/__tests__/unit/components/Search.test.tsx (5 hunks)
  • frontend/src/components/MultiSearch.tsx (1 hunks)
  • frontend/src/components/Search.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Search.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.
📚 Learning: 2025-09-17T02:42:41.928Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.

Applied to files:

  • frontend/__tests__/unit/components/Search.test.tsx
  • frontend/src/components/MultiSearch.tsx
📚 Learning: 2025-11-17T16:47:05.578Z
Learnt from: anurag2787
Repo: OWASP/Nest PR: 2671
File: frontend/__tests__/unit/components/MultiSearch.test.tsx:427-427
Timestamp: 2025-11-17T16:47:05.578Z
Learning: In the frontend test files for the OWASP/Nest repository, `expect(true).toBe(true)` no-op assertions may be intentionally added as workarounds when ESLint rule jest/expect-expect doesn't detect expectations inside helper functions or waitFor callbacks. These can be resolved by configuring the ESLint rule's assertFunctionNames option to recognize custom assertion helpers instead of flagging them as redundant.

Applied to files:

  • frontend/__tests__/unit/components/Search.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (2)
frontend/src/components/MultiSearch.tsx (1)

246-246: LGTM! Hover states correctly fix the visibility issue.

The updated styling properly addresses the issue where the clear-search icon became invisible on hover. The hover:text-gray-200 paired with hover:bg-gray-400 (light mode) and dark:hover:bg-gray-600 (dark mode) ensures the icon remains visible and provides good contrast in both themes. The shape change to rounded-md also creates consistency across all search bars as intended.

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

76-371: LGTM! Test updates correctly reflect the implementation changes.

The test selectors and className assertions have been properly updated to match the new clear button styling (rounded-md and expanded hover/focus states). Test coverage remains comprehensive and all scenarios continue to verify the expected behavior.

Tip

✨ Issue Enrichment is now available for GitHub issues!

CodeRabbit can now help you manage issues more effectively:

  • Duplicate Detection — Identify similar or duplicate issues
  • Related Issues & PRs — Find relevant issues and PR's from your repository
  • Suggested Assignees — Find the best person to work on the issue
  • Implementation Planning — Generate detailed coding plans for engineers and agents
Disable automatic issue enrichment

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

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
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 (1)
frontend/src/components/MultiSearch.tsx (1)

244-253: Align clear button hover + focus styles with SearchBar for consistency

This update fixes the icon-visibility issue (hover background + text color look fine in both themes), but the clear button here now behaves slightly differently from the one in Search.tsx:

  • Different hover palette (hover:bg-gray-600 hover:text-gray-200 vs hover:bg-gray-800 dark:hover:bg-gray-400 hover:text-gray-100 dark:hover:text-gray-800).
  • No explicit focus styles here, while Search.tsx adds a focus ring.

Given the PR goal of consistent clear-search UI across all search bars, it’s worth standardizing both the hover palette and focus treatment. For example, you could mirror the SearchBar button styles:

-              <button
-                type="button"
-                className="absolute top-1/2 right-2 -translate-y-1/2 rounded-full p-1 w-8 h-8 text-gray-400 
-                hover:bg-gray-600
-                hover:text-gray-200"
+              <button
+                type="button"
+                className="absolute top-1/2 right-2 -translate-y-1/2 rounded-full p-1 w-8 h-8 text-gray-400
+                focus:ring-2 focus:ring-gray-300 focus:outline-hidden
+                hover:bg-gray-800 dark:hover:bg-gray-400 hover:text-gray-100 dark:hover:text-gray-800"
                 onClick={handleClearSearch}
                 aria-label="Clear search"
               >

If design intentionally wants slightly different palettes between these contexts, I’d still recommend at least adding the focus ring here for keyboard/a11y parity.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfef4da and f684129.

📒 Files selected for processing (2)
  • frontend/src/components/MultiSearch.tsx (1 hunks)
  • frontend/src/components/Search.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.
📚 Learning: 2025-09-17T02:42:41.928Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.

Applied to files:

  • frontend/src/components/Search.tsx
  • frontend/src/components/MultiSearch.tsx
🔇 Additional comments (1)
frontend/src/components/Search.tsx (1)

88-97: Clear button hover/focus behavior looks correct and fixes the visibility bug

The updated classes give the clear button a consistent, accessible behavior:

  • Fixed size (w-8 h-8) keeps the hit area predictable.
  • Default text-gray-400 and the hover pairs (hover:bg-gray-800 + hover:text-gray-100, dark:hover:bg-gray-400 + dark:hover:text-gray-800) ensure good contrast in both light and dark themes.
  • Added focus:ring-2 focus:ring-gray-300 focus:outline-hidden provides a clear keyboard focus indicator.

Click behavior and ARIA labeling are unchanged, so functionality is preserved while fixing the visual inconsistency described in the issue.

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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f684129 and 018ca1f.

📒 Files selected for processing (2)
  • frontend/src/components/MultiSearch.tsx (1 hunks)
  • frontend/src/components/Search.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-17T02:42:41.928Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.

Applied to files:

  • frontend/src/components/MultiSearch.tsx
  • frontend/src/components/Search.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Run frontend checks
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (1)
frontend/src/components/Search.tsx (1)

90-90: Verify WCAG contrast compliance for light mode hover state.

The explicit dimensions (h-8 w-8) and focus ring are good additions. However, the hover styling differs from the suggested fix in issue #2849. Your implementation uses hover:bg-gray-400 with hover:text-gray-200 for light mode.

Gray text (#E5E7EB) on a gray background (#9CA3AF) may not meet the WCAG AA contrast requirement of 3:1 for UI components. The dark mode state (dark:hover:bg-gray-600) should have sufficient contrast, but please verify the light mode hover colors meet accessibility standards.

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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 018ca1f and 1fb937e.

📒 Files selected for processing (1)
  • frontend/src/components/Search.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-17T02:42:41.928Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.

Applied to files:

  • frontend/src/components/Search.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)
  • GitHub Check: Run frontend checks
  • GitHub Check: Run spell check
  • GitHub Check: Run pre-commit checks

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 (2)
frontend/src/components/MultiSearch.tsx (1)

246-246: LGTM! Clear-search icon hover issue resolved.

The className updates successfully fix the original issue where the clear-search icon was invisible on hover. The new hover states (hover:text-gray-200 on hover:bg-gray-400) ensure the icon remains visible in light mode, and dark:hover:bg-gray-600 handles dark mode appropriately. Focus accessibility is properly addressed with the focus ring classes.

Optional: Add explicit dark mode focus ring for consistency.

The input field at line 241 specifies dark:focus:ring-blue-300, but the button only has focus:ring-gray-300 (which applies to both light and dark modes). Consider adding dark:focus:ring-gray-400 for a more visible focus indicator in dark mode:

-                className="absolute top-1/2 right-2 h-8 w-8 -translate-y-1/2 rounded-full p-1 text-gray-400 hover:bg-gray-400 hover:text-gray-200 focus:ring-2 focus:ring-gray-300 focus:outline-hidden dark:hover:bg-gray-600"
+                className="absolute top-1/2 right-2 h-8 w-8 -translate-y-1/2 rounded-full p-1 text-gray-400 hover:bg-gray-400 hover:text-gray-200 focus:ring-2 focus:ring-gray-300 focus:outline-hidden dark:hover:bg-gray-600 dark:focus:ring-gray-400"
frontend/src/components/Search.tsx (1)

90-90: LGTM! Consistent styling across search components.

The className updates mirror the changes in MultiSearch.tsx, ensuring a consistent clear-search button appearance and behavior across the codebase. The hover state fix (hover:text-gray-200 on hover:bg-gray-400) resolves the visibility issue described in issue #2849, and focus states provide proper keyboard accessibility.

Optional: Consider explicit dark mode focus ring.

For enhanced visibility and consistency with the input field's dark mode styling at line 85, consider adding dark:focus:ring-gray-400:

-                className="absolute top-1/2 right-2 h-8 w-8 -translate-y-1/2 rounded-full p-1 text-gray-400 hover:bg-gray-400 hover:text-gray-200 focus:ring-2 focus:ring-gray-300 focus:outline-hidden dark:hover:bg-gray-600"
+                className="absolute top-1/2 right-2 h-8 w-8 -translate-y-1/2 rounded-full p-1 text-gray-400 hover:bg-gray-400 hover:text-gray-200 focus:ring-2 focus:ring-gray-300 focus:outline-hidden dark:hover:bg-gray-600 dark:focus:ring-gray-400"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fb937e and 3923ee6.

📒 Files selected for processing (2)
  • frontend/src/components/MultiSearch.tsx (1 hunks)
  • frontend/src/components/Search.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-17T02:42:41.928Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 2288
File: frontend/src/components/ActionButton.tsx:0-0
Timestamp: 2025-09-17T02:42:41.928Z
Learning: In frontend/src/components/ActionButton.tsx, the user Rajgupta36 intentionally changed text-blue-600 to text-[#1D7BD7] to align the text color with the border color (#1D7BD7) for visual consistency, prioritizing design alignment over theme tokens.

Applied to files:

  • frontend/src/components/MultiSearch.tsx
  • frontend/src/components/Search.tsx
📚 Learning: 2025-04-30T13:41:20.846Z
Learnt from: codic-yeeshu
Repo: OWASP/Nest PR: 1444
File: frontend/src/components/NavDropDown.tsx:0-0
Timestamp: 2025-04-30T13:41:20.846Z
Learning: When implementing dropdown menus or similar interactive components, always include proper accessibility features: ARIA attributes (aria-expanded, aria-haspopup, aria-controls), keyboard navigation support (Enter, Space, Escape keys), and mechanisms to close dropdowns when clicking outside.

Applied to files:

  • frontend/src/components/Search.tsx

@anirudhprmar
Copy link
Contributor Author

anirudhprmar commented Dec 12, 2025

I just saw you that you also edited the frontend tests. I made a mistake there before pushing the PR I did ran make check but it was on the main branch that's why it didn't caused any error. Really sorry for any inconvenience this caused.

@anirudhprmar
Copy link
Contributor Author

anirudhprmar commented Dec 13, 2025

@arkid15r can you look into this review , wasn't able to merge it because by the time i tried the main branch had new commits and i had to update the branch again.

@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.

@anirudhprmar thanks for working on this! 👍🏼

@kasya kasya added this pull request to the merge queue Dec 13, 2025
Merged via the queue into OWASP:main with commit 9ba1672 Dec 13, 2025
26 checks passed
@anirudhprmar anirudhprmar deleted the fix/inconsistent-ui branch December 14, 2025 01:27
@coderabbitai coderabbitai bot mentioned this pull request Dec 15, 2025
3 tasks
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.

Inconsistent UI of clear search x mark

2 participants