Skip to content

Conversation

@Nishal77
Copy link

@Nishal77 Nishal77 commented Nov 19, 2025

Description

Adds tooltips to navbar elements (search, face search, profile, theme toggle) to improve user experience and provide better context for interactive elements.

Changes

  • Added tooltips to navbar search button, face search dialog, user profile avatar, and theme toggle
  • Improved accessibility with proper ARIA labels

Testing

  • Tooltips display correctly on hover
  • Tooltips work in both light and dark themes
  • No console errors
  • Accessible via keyboard navigation
Screen.Recording.2025-11-19.at.4.03.37.PM.mov

Summary by CodeRabbit

  • UI/UX Enhancements

    • Added tooltips to navigation controls, search/clear buttons, theme toggle, profile link, and face-search trigger; updated dialog title and informational text for clearer wording.
  • Accessibility Improvements

    • Improved screen-reader descriptions and aria-labels (e.g., "Search by face") to better communicate control purpose.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

Adds Tooltip wrappers and small accessibility/text tweaks to interactive controls in Navbar, ThemeToggle, and FaceSearchDialog, providing hover labels for close/clear, search, face-search, theme-toggle, and profile/settings elements; no public API or control-flow changes.

Changes

Cohort / File(s) Summary
Navbar tooltip enhancements
frontend/src/components/Navigation/Navbar/Navbar.tsx
Wraps close/clear, static search button, and user avatar/settings link with Tooltip, TooltipTrigger, and TooltipContent providing labels like "Clear search", "Search images", and "Profile settings". Adds Tooltip imports.
Theme toggle tooltip enhancement
frontend/src/components/ThemeToggle.tsx
Wraps the ThemeSelector/DropdownMenu trigger with Tooltip, TooltipTrigger, and TooltipContent showing "Toggle theme"; trigger and menu items remain functionally unchanged.
Face search dialog tooltip & copy
frontend/src/components/Dialog/FaceSearchDialog.tsx
Wraps the Face Search dialog trigger with Tooltip/TooltipTrigger, adds aria-label="Search by face" and sr-only text updates, changes dialog title to "Search by Face", and fixes an ASCII-encoded informational string.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check for unused Tooltip imports and build warnings.
  • Verify aria-label/sr-only text and tooltip do not conflict for keyboard/screen-reader users.
  • Quick visual check for tooltip overflow or layout regressions.

Possibly related PRs

Suggested labels

UI

Suggested reviewers

  • rahulharpal1603

Poem

🐇 I hop through code with ears held high,
I tuck tooltips where the cursors fly,
"Clear", "Search", "Toggle" — soft words in a row,
A tiny kind guide where users go,
Hop, hover, click — and onward we go. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding tooltips to navbar elements across multiple components including search, face search, profile, and theme toggle.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

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

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8dbc960 and f61688c.

📒 Files selected for processing (2)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (4 hunks)
  • frontend/src/components/ThemeToggle.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/src/components/ThemeToggle.tsx (4)
frontend/src/contexts/ThemeContext.tsx (1)
  • useTheme (66-73)
frontend/src/components/ui/tooltip.tsx (3)
  • Tooltip (59-59)
  • TooltipTrigger (59-59)
  • TooltipContent (59-59)
frontend/src/components/ui/dropdown-menu.tsx (4)
  • DropdownMenu (240-240)
  • DropdownMenuTrigger (242-242)
  • DropdownMenuContent (243-243)
  • DropdownMenuItem (246-246)
frontend/src/components/ui/button.tsx (1)
  • Button (59-59)
frontend/src/components/Navigation/Navbar/Navbar.tsx (3)
frontend/src/components/ui/tooltip.tsx (3)
  • Tooltip (59-59)
  • TooltipTrigger (59-59)
  • TooltipContent (59-59)
frontend/src/features/searchSlice.ts (1)
  • clearSearch (21-24)
frontend/src/components/Dialog/FaceSearchDialog.tsx (1)
  • FaceSearchDialog (25-153)
🔇 Additional comments (3)
frontend/src/components/ThemeToggle.tsx (2)

10-14: LGTM!

The Tooltip component imports are correct and follow the established import pattern.


21-61: Verify tooltip behavior with nested dropdown interaction.

The tooltip wrapping the dropdown trigger should work correctly with asChild, but please confirm:

  • Hovering shows the tooltip without immediately opening the dropdown
  • Clicking still opens the dropdown menu properly
  • Keyboard navigation (Tab, Enter, Escape) works as expected
  • The tooltip dismisses appropriately when the dropdown opens

Minor note: Line 33's sr-only span is redundant with the aria-label on line 29—both provide the same screen reader text. Consider removing the sr-only span.

frontend/src/components/Navigation/Navbar/Navbar.tsx (1)

9-13: LGTM!

The Tooltip component imports are correct.

Comment on lines +50 to +63
<Tooltip>
<TooltipTrigger asChild>
<button
onClick={() => dispatch(clearSearch())}
className="absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white"
aria-label="Close"
>
</button>
</TooltipTrigger>
<TooltipContent>
<p>Clear search</p>
</TooltipContent>
</Tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align aria-label with tooltip text for consistency.

The button's aria-label="Close" (line 55) doesn't match the tooltip text "Clear search" (line 61). Since the action clears the search query, "Clear search" is more descriptive. Update the aria-label to match.

Apply this diff:

-                      aria-label="Close"
+                      aria-label="Clear search"
📝 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
<Tooltip>
<TooltipTrigger asChild>
<button
onClick={() => dispatch(clearSearch())}
className="absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white"
aria-label="Close"
>
</button>
</TooltipTrigger>
<TooltipContent>
<p>Clear search</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<button
onClick={() => dispatch(clearSearch())}
className="absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white"
aria-label="Clear search"
>
</button>
</TooltipTrigger>
<TooltipContent>
<p>Clear search</p>
</TooltipContent>
</Tooltip>
🤖 Prompt for AI Agents
In frontend/src/components/Navigation/Navbar/Navbar.tsx around lines 50 to 63,
the button's aria-label is "Close" while the tooltip reads "Clear search";
update the button's aria-label to "Clear search" so it matches the tooltip and
accurately describes the action (i.e., replace aria-label="Close" with
aria-label="Clear search").

Comment on lines 76 to 85
<Tooltip>
<TooltipTrigger asChild>
<div>
<FaceSearchDialog />
</div>
</TooltipTrigger>
<TooltipContent>
<p>Search by face</p>
</TooltipContent>
</Tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove the intermediate div wrapper—it prevents proper tooltip interaction.

The TooltipTrigger asChild expects its direct child to be an interactive element that can accept merged props. Wrapping FaceSearchDialog in a <div> (line 78) means the tooltip attaches to a non-interactive element, which can break hover behavior and accessibility.

Recommended approach: Remove the div wrapper and apply TooltipTrigger asChild directly to the trigger element. Since FaceSearchDialog renders a Dialog with a DialogTrigger > Button, you'll need to restructure slightly. One solution:

-          <Tooltip>
-            <TooltipTrigger asChild>
-              <div>
-                <FaceSearchDialog />
-              </div>
-            </TooltipTrigger>
-            <TooltipContent>
-              <p>Search by face</p>
-            </TooltipContent>
-          </Tooltip>
+          <FaceSearchDialog />

Then modify FaceSearchDialog.tsx to wrap its DialogTrigger button with Tooltip internally, similar to how you've done with the search button and avatar in this file.

Minor note: The tooltip says "Search by face" but FaceSearchDialog's button has aria-label="Face Detection Search". Align the terminology for consistency.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In frontend/src/components/Navigation/Navbar/Navbar.tsx around lines 76 to 85,
remove the intermediate <div> used as the child of <TooltipTrigger asChild> so
the TooltipTrigger can attach directly to the interactive trigger; either render
<TooltipTrigger asChild><FaceSearchDialog /></TooltipTrigger> (if
FaceSearchDialog forwards the trigger props) or move the Tooltip wrapping into
FaceSearchDialog so its DialogTrigger button is the direct child of the
TooltipTrigger; update FaceSearchDialog to forward refs/props or to wrap its
DialogTrigger button with Tooltip internally, and align the tooltip text "Search
by face" with the button aria-label (e.g., change to "Face Search" or "Face
Detection Search") for consistent accessibility labeling.

Comment on lines +88 to +100
<Tooltip>
<TooltipTrigger asChild>
<button
className="text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 hover:text-foreground mx-1 cursor-pointer rounded-sm p-2"
aria-label="Search"
>
<Search className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent>
<p>Search images</p>
</TooltipContent>
</Tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align aria-label with tooltip text for consistency.

The button's aria-label="Search" (line 92) is less specific than the tooltip text "Search images" (line 98). Update the aria-label to match.

Apply this diff:

-                aria-label="Search"
+                aria-label="Search images"
📝 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
<Tooltip>
<TooltipTrigger asChild>
<button
className="text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 hover:text-foreground mx-1 cursor-pointer rounded-sm p-2"
aria-label="Search"
>
<Search className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent>
<p>Search images</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<button
className="text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 hover:text-foreground mx-1 cursor-pointer rounded-sm p-2"
aria-label="Search images"
>
<Search className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent>
<p>Search images</p>
</TooltipContent>
</Tooltip>
🤖 Prompt for AI Agents
frontend/src/components/Navigation/Navbar/Navbar.tsx around lines 88 to 100: the
button's aria-label currently reads "Search" while the TooltipContent says
"Search images"; update the button's aria-label to exactly "Search images" so
screen readers match the visible tooltip and improve accessibility/consistency.

Comment on lines +111 to +124
<Tooltip>
<TooltipTrigger asChild>
<a href="/settings" className="p-2">
<img
src={userAvatar || '/photo1.png'}
className="hover:ring-primary/50 h-8 w-8 cursor-pointer rounded-full transition-all hover:ring-2"
alt="User avatar"
/>
</a>
</TooltipTrigger>
<TooltipContent>
<p>Profile settings</p>
</TooltipContent>
</Tooltip>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add aria-label to the profile settings link.

The anchor on line 113 is missing an aria-label, which would improve accessibility for screen reader users. While the image has alt="User avatar", the link's purpose (navigating to settings) isn't explicitly conveyed.

Apply this diff:

-              <a href="/settings" className="p-2">
+              <a href="/settings" className="p-2" aria-label="Profile settings">
📝 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
<Tooltip>
<TooltipTrigger asChild>
<a href="/settings" className="p-2">
<img
src={userAvatar || '/photo1.png'}
className="hover:ring-primary/50 h-8 w-8 cursor-pointer rounded-full transition-all hover:ring-2"
alt="User avatar"
/>
</a>
</TooltipTrigger>
<TooltipContent>
<p>Profile settings</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<a href="/settings" className="p-2" aria-label="Profile settings">
<img
src={userAvatar || '/photo1.png'}
className="hover:ring-primary/50 h-8 w-8 cursor-pointer rounded-full transition-all hover:ring-2"
alt="User avatar"
/>
</a>
</TooltipTrigger>
<TooltipContent>
<p>Profile settings</p>
</TooltipContent>
</Tooltip>
🤖 Prompt for AI Agents
In frontend/src/components/Navigation/Navbar/Navbar.tsx around lines 111 to 124,
the anchor linking to /settings is missing an aria-label which means screen
readers don't get the explicit purpose of the link; add a descriptive aria-label
attribute to the <a> (for example aria-label="Open profile settings" or similar
localized text) while keeping the existing image alt intact so the link's
function is conveyed to assistive technologies.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

1 similar comment
@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

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

♻️ Duplicate comments (3)
frontend/src/components/Navigation/Navbar/Navbar.tsx (3)

50-63: Update aria-label to match tooltip text.

The button's aria-label="Close" (line 55) doesn't align with the tooltip text "Clear search" (line 61). For consistency and better accessibility, the aria-label should match the tooltip content.

Apply this diff:

-                      aria-label="Close"
+                      aria-label="Clear search"

78-91: Update aria-label to match tooltip text.

The button's aria-label="Search" (line 83) is less descriptive than the tooltip text "Search images" (line 89). Aligning these improves accessibility and consistency.

Apply this diff:

-                aria-label="Search"
+                aria-label="Search images"

102-115: Add aria-label to the profile settings link.

The anchor element (line 104) is missing an aria-label attribute, which would improve accessibility for screen reader users. While the image has alt="User avatar", the link's purpose (navigating to settings) isn't explicitly conveyed.

Apply this diff:

-              <a href="/settings" className="p-2">
+              <a href="/settings" className="p-2" aria-label="Profile settings">
🧹 Nitpick comments (1)
frontend/src/components/Dialog/FaceSearchDialog.tsx (1)

107-110: Remove redundant accessibility attribute.

The button has both aria-label and a sr-only span containing the same text. The aria-label takes precedence and makes the sr-only span unnecessary.

Apply this diff to remove the redundant sr-only span:

               aria-label="Search by face"
             >
               <ScanFace className="h-4 w-4" />
-              <span className="sr-only">Search by face</span>
             </Button>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f61688c and 7963b8f.

📒 Files selected for processing (2)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx (4 hunks)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/src/components/Navigation/Navbar/Navbar.tsx (2)
frontend/src/components/ui/tooltip.tsx (3)
  • Tooltip (59-59)
  • TooltipTrigger (59-59)
  • TooltipContent (59-59)
frontend/src/features/searchSlice.ts (1)
  • clearSearch (21-24)
frontend/src/components/Dialog/FaceSearchDialog.tsx (2)
frontend/src/components/ui/tooltip.tsx (1)
  • Tooltip (59-59)
frontend/src/components/ui/dialog.tsx (4)
  • DialogTrigger (142-142)
  • DialogContent (135-135)
  • DialogHeader (138-138)
  • DialogTitle (141-141)
🔇 Additional comments (5)
frontend/src/components/Navigation/Navbar/Navbar.tsx (2)

9-13: LGTM!

The tooltip component imports are correctly structured and necessary for the tooltip functionality added throughout this file.


9-13: The review comment is incorrect and can be dismissed.

The Tooltip component in frontend/src/components/ui/tooltip.tsx already wraps its children with <TooltipProvider> internally (lines 23-25). This means each Tooltip instance is self-contained and automatically includes the provider—no app-root level provider is required. The Navbar component's usage is correct as-is.

Likely an incorrect or invalid review comment.

frontend/src/components/Dialog/FaceSearchDialog.tsx (3)

12-16: LGTM!

The Tooltip component imports are correctly added and necessary for the tooltip functionality implemented below.


51-51: LGTM!

Good catch replacing the curly quote with a standard ASCII quote for consistency.


121-121: LGTM!

The updated dialog title "Search by Face" is more concise and aligns well with the tooltip and accessibility labels used throughout the component.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

1 similar comment
@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

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/Dialog/FaceSearchDialog.tsx (1)

106-109: Remove redundant sr-only span.

The aria-label on line 106 provides the accessible name and takes precedence over inner content. The <span className="sr-only"> on line 109 serves no purpose and can be removed.

Apply this diff:

               className="h-8 w-8 cursor-pointer p-1"
               aria-label="Search by face"
             >
               <ScanFace className="h-4 w-4" />
-              <span className="sr-only">Search by face</span>
             </Button>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7963b8f and 9632189.

📒 Files selected for processing (1)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/Dialog/FaceSearchDialog.tsx (2)
frontend/src/components/ui/tooltip.tsx (3)
  • Tooltip (59-59)
  • TooltipTrigger (59-59)
  • TooltipContent (59-59)
frontend/src/components/ui/dialog.tsx (4)
  • DialogTrigger (142-142)
  • DialogContent (135-135)
  • DialogHeader (138-138)
  • DialogTitle (141-141)
🔇 Additional comments (4)
frontend/src/components/Dialog/FaceSearchDialog.tsx (4)

12-16: LGTM!

The Tooltip component imports are correctly added and necessary for the new tooltip functionality.


51-51: LGTM!

Good correction replacing the curly apostrophe with a straight apostrophe for better ASCII compatibility in the error message.


120-120: LGTM!

Excellent consistency improvement. The dialog title now matches the button label and tooltip text, providing a clearer and more cohesive user experience.


99-116: Based on my verification using the codebase analysis and official Radix UI documentation, I can now provide the final response.

The original review comment's concerns are not valid.

The code implementation is correct. The correct pattern is to place the outermost wrapper (like Tooltip) outside, and the final DOM element (like Button) inside both DialogTrigger and TooltipTrigger, using asChild. Your code at lines 99-116 follows exactly this pattern:

<Tooltip>
  <TooltipTrigger asChild>
    <DialogTrigger asChild>
      <Button>

Regarding TooltipProvider: Tooltip.Provider is now required, and from the codebase inspection, the Tooltip component in frontend/src/components/ui/tooltip.tsx (lines 23-25) already wraps itself with TooltipProvider internally. Additionally, the Sidebar component (which likely contains this dialog) wraps content with an explicit TooltipProvider.

The tooltip and dialog will compose correctly together without conflicts.

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