Skip to content

Added title and aria-labels to buttons#576

Merged
rahulharpal1603 merged 6 commits intoAOSSIE-Org:mainfrom
Pritom2357:add_title_to_buttons
Oct 28, 2025
Merged

Added title and aria-labels to buttons#576
rahulharpal1603 merged 6 commits intoAOSSIE-Org:mainfrom
Pritom2357:add_title_to_buttons

Conversation

@Pritom2357
Copy link
Contributor

@Pritom2357 Pritom2357 commented Oct 8, 2025

Description

Summary

  • Added accessible names (aria-label) and hover titles to icon-only buttons.
  • Scope: Face Search trigger, Dialog close “X”, and Media Info panel actions.

Why

  • Icon-only buttons are not announced by screen readers without an accessible name.
  • title provides simple, native hover hints without extra UI.

Changes

  • FaceSearchDialog.tsx
    • Ensure trigger button has title="Face Detection Search" and aria-label="Face Detection Search".
    • Keep sr-only text for assistive tech.
  • components/ui/dialog.tsx
    • Add title="Close" and aria-label="Close" to DialogPrimitive.Close (the “X”).
  • MediaInfoPanel.tsx
    • Add title="Close" to the info panel close icon (already has aria-label).

Linked Issue
issue: 575

Demo:
pull_req_3

Testing

  • Hover over Face Search trigger → shows “Face Detection Search”.
  • Open any dialog → hover over “X” → shows “Close”.
  • Open Media Info panel → hover over close icon shows “Close”;
  • Screen reader announces buttons by their aria-labels.
  • No layout/runtime regressions; lint/format pass.

Checklist

  • Titles added to icon-only buttons
  • aria-labels present where needed
  • Manual test on Windows (Tauri dev)
  • Lint/format pass

Summary by CodeRabbit

  • Style
    • Added titles and ARIA labels to improve accessibility and tooltips on interactive controls.
    • Affected areas: face search button, image card hover actions (favorite, share), media viewer controls (info, wallpaper, open folder/open with, share, close, dynamic favorite state), zoom controls, navbar actions (close, search), theme toggle, and dialog close.
    • No behavioral, data, or public API changes.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

⚠️ 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 Oct 8, 2025

Walkthrough

Added title and aria-label accessibility attributes to many interactive buttons across dialogs, media controls, navbar, and theme toggle. No logic, state, control-flow, or exported API changes. (≈24 words)

Changes

Cohort / File(s) Summary of Changes
Dialogs
frontend/src/components/Dialog/FaceSearchDialog.tsx, frontend/src/components/ui/dialog.tsx
Added title and aria-label to Face Search and Dialog close buttons; no behavior changes.
Media Components
frontend/src/components/Media/ImageCard.tsx, frontend/src/components/Media/MediaViewControls.tsx, frontend/src/components/Media/ZoomControls.tsx
Added title and/or aria-label attributes to favorite, share, show-info, wallpaper, folder, open-with, close, zoom, rotate, and reset buttons; favorites title toggles by state; no logic changes.
Navigation
frontend/src/components/Navigation/Navbar/Navbar.tsx
Added title and aria-label to Close and Search controls in the navbar/query-image block; no control-flow changes.
Theme
frontend/src/components/ThemeToggle.tsx
Added title and aria-label to the theme toggle trigger button; no functional changes.

Sequence Diagram(s)

(omitted — changes are only accessibility attributes on existing UI controls; no new control-flow or interactions introduced)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

UI

Suggested reviewers

  • rahulharpal1603

Poem

A rabbit hops through code so spry,
Adding whispers to each button nigh.
Titles bright and ARIA tunes,
Screen readers hum soft runes.
Hoppy labels—access for every eye. 🐇✨

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 PR title "Added title and aria-labels to buttons" accurately and directly reflects the primary change in the changeset. The pull request systematically adds title attributes and aria-label attributes to multiple buttons across seven different component files (FaceSearchDialog, ImageCard, MediaViewControls, ZoomControls, Navbar, ThemeToggle, and dialog) to improve accessibility. The title is concise, specific, and clearly communicates the nature of the changes without being vague or misleading. A developer reviewing the commit history would immediately understand that this PR focuses on adding accessibility attributes to buttons.
✨ 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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b72bc31 and ef6c6cf.

📒 Files selected for processing (2)
  • frontend/src/components/Media/MediaViewControls.tsx (3 hunks)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx
  • frontend/src/components/Media/MediaViewControls.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). (4)
  • GitHub Check: Tauri Build Check (ubuntu-22.04)
  • GitHub Check: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (windows-latest)
  • GitHub Check: Backend 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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

⚠️ 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

🧹 Nitpick comments (8)
frontend/src/components/ui/dialog.tsx (1)

71-75: Remove redundant aria-label as sr-only text already provides accessible name.

The button already has an sr-only span with "Close" (Line 75), which serves the same purpose as aria-label. Having both is redundant. The title attribute is sufficient for the hover tooltip.

Apply this diff to remove the redundant aria-label:

           <DialogPrimitive.Close
             data-slot="dialog-close"
             className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
-            title='Close'
-            aria-label='Close'
+            title="Close"
           >

Additionally, run prettier --write to fix the quote style as indicated by the pipeline failure.

frontend/src/components/ThemeToggle.tsx (1)

18-21: Fix capitalization inconsistency and remove redundant aria-label.

Two issues:

  1. Capitalization mismatch: title='Themes' uses capital T while aria-label='themes' uses lowercase. These should match.
  2. The button already has sr-only text "Toggle theme" (Line 21), making aria-label redundant.

Apply this diff:

-        <Button variant="outline" size="icon" title='Themes' aria-label='themes'>
+        <Button variant="outline" size="icon" title="Themes">

Run prettier --write to fix the quote style as indicated by the pipeline failure.

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

78-82: Remove redundant aria-label as sr-only text already provides accessible name.

The button already has an sr-only span with "Face Detection Search" (Line 82), which provides the same accessible name as aria-label. The title attribute is sufficient for the hover tooltip.

Apply this diff:

           variant="ghost"
           size="icon"
           className="h-8 w-8 p-1"
-          title='Face Detection Search'
-          aria-label='Face Detection Search'
+          title="Face Detection Search"
         >

Run prettier --write to fix the quote style as indicated by the pipeline failure.

frontend/src/components/Media/ZoomControls.tsx (1)

26-57: Use consistent quote style for attributes.

The file mixes single quotes (title='Zoom Out') and double quotes (aria-label="Zoom In"). Use consistent double quotes throughout.

Run prettier --write as indicated by the pipeline failure to automatically fix quote consistency and other formatting issues.

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

65-70: Fix formatting of button attributes.

The button opening tag spans multiple lines in an inconsistent manner. While this may work syntactically, it reduces readability.

Run prettier --write to automatically format this correctly, as indicated by the pipeline failure.


76-79: Remove redundant aria-label as sr-only text already provides accessible name.

The button already has an sr-only span with "Notifications" (Line 79), making the aria-label redundant. The title attribute is sufficient for the hover tooltip.

Apply this diff:

-        <Button variant="ghost" size="icon" className="relative" title='Notifications' aria-label='Notifications'>
+        <Button variant="ghost" size="icon" className="relative" title="Notifications">

Run prettier --write to fix the quote style as indicated by the pipeline failure.

frontend/src/components/Media/ImageCard.tsx (2)

81-90: Fix inconsistency: aria-label should match the dynamic title or be removed.

The title attribute dynamically reflects the button state (Line 81), but the aria-label is static as "Add to Favorites" (Line 82). This creates an inconsistency.

Additionally, the button already has an sr-only span with "Favorite" (Line 90), making aria-label redundant.

Apply this diff to remove the redundant static aria-label:

               onClick={(e) => {
                 e.stopPropagation();
                 setIsFavorite(!isFavorite);
               }}
-              title={isFavorite ? 'Remove from favorites' : 'Add to favorites'}
-              aria-label='Add to Favorites'
+              title={isFavorite ? "Remove from favorites" : "Add to favorites"}
             >

If you want both dynamic title and aria-label, make them match:

-              title={isFavorite ? 'Remove from favorites' : 'Add to favorites'}
-              aria-label='Add to Favorites'
+              title={isFavorite ? "Remove from favorites" : "Add to favorites"}
+              aria-label={isFavorite ? "Remove from favorites" : "Add to favorites"}

Run prettier --write to fix the quote style as indicated by the pipeline failure.


97-101: Remove redundant aria-label as sr-only text already provides accessible name.

The button already has an sr-only span with "Share" (Line 101), making the aria-label redundant. The title attribute is sufficient for the hover tooltip.

Apply this diff:

               className="rounded-full bg-white/20 text-white hover:!bg-white/40 hover:!text-white"
               onClick={(e) => e.stopPropagation()}
-              title='Share'
-              aria-label='Share'
+              title="Share"
             >

Run prettier --write to fix the quote style as indicated by the pipeline failure.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 589d71f and 7b704c6.

📒 Files selected for processing (8)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx (1 hunks)
  • frontend/src/components/Media/ImageCard.tsx (2 hunks)
  • frontend/src/components/Media/MediaView.tsx (1 hunks)
  • frontend/src/components/Media/MediaViewControls.tsx (3 hunks)
  • frontend/src/components/Media/ZoomControls.tsx (1 hunks)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (2 hunks)
  • frontend/src/components/ThemeToggle.tsx (1 hunks)
  • frontend/src/components/ui/dialog.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/ThemeToggle.tsx (1)
frontend/src/components/ui/button.tsx (1)
  • Button (59-59)
🪛 GitHub Actions: PR Check
frontend/src/components/ui/dialog.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Media/ZoomControls.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Media/MediaViewControls.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Media/MediaView.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Media/ImageCard.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Navigation/Navbar/Navbar.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/Dialog/FaceSearchDialog.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

frontend/src/components/ThemeToggle.tsx

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

⏰ 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: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (ubuntu-22.04)
  • GitHub Check: Tauri Build Check (windows-latest)
🔇 Additional comments (2)
frontend/src/components/Media/MediaViewControls.tsx (1)

38-127: LGTM! Run Prettier to fix quote style.

The accessibility enhancements look good. The dynamic title on the favorites button (Line 89) properly reflects the button's current state, and all other buttons have appropriate static titles.

Run prettier --write to fix the quote style as indicated by the pipeline failure.

frontend/src/components/Media/ZoomControls.tsx (1)

35-40: Fix syntax error: aria-label is incorrectly placed within className string.

Line 37 has aria-label='Reset' incorrectly placed in the middle of the className attribute string. This is a syntax error that will break the component.

Apply this diff to fix:

         <button
           onClick={onReset}
-          className="rounded-md bg-white/10 px-3 py-2 text-sm font-medium text-white transition-all duration-200 hover:bg-white/20 hover:shadow-md" aria-label='Reset'
+          className="rounded-md bg-white/10 px-3 py-2 text-sm font-medium text-white transition-all duration-200 hover:bg-white/20 hover:shadow-md"
+          aria-label="Reset"
+          title="Reset"
         >

Likely an incorrect or invalid review 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')

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/Media/ZoomControls.tsx (1)

35-41: Remove unnecessary aria-label from text button.

The Reset button has visible text content ("Reset"), so the aria-label attribute is redundant. According to accessibility best practices, aria-label should only be used on icon-only or visually ambiguous buttons. When a button has visible text, the text content automatically serves as the accessible name. Adding aria-label can override this and potentially confuse screen reader users.

Apply this diff to remove the redundant attribute:

         <button
           onClick={onReset}
           className="rounded-md bg-white/10 px-3 py-2 text-sm font-medium text-white transition-all duration-200 hover:bg-white/20 hover:shadow-md"
-          aria-label="Reset"
         >
           Reset
         </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 7b704c6 and d482b4e.

📒 Files selected for processing (7)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx (1 hunks)
  • frontend/src/components/Media/ImageCard.tsx (2 hunks)
  • frontend/src/components/Media/MediaViewControls.tsx (3 hunks)
  • frontend/src/components/Media/ZoomControls.tsx (3 hunks)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (2 hunks)
  • frontend/src/components/ThemeToggle.tsx (1 hunks)
  • frontend/src/components/ui/dialog.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx
  • frontend/src/components/Media/ImageCard.tsx
  • frontend/src/components/ThemeToggle.tsx
  • frontend/src/components/Navigation/Navbar/Navbar.tsx
  • frontend/src/components/Media/MediaViewControls.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). (4)
  • GitHub Check: Tauri Build Check (ubuntu-22.04)
  • GitHub Check: Tauri Build Check (macos-latest, --target aarch64-apple-darwin)
  • GitHub Check: Tauri Build Check (windows-latest)
  • GitHub Check: Backend Tests
🔇 Additional comments (2)
frontend/src/components/Media/ZoomControls.tsx (1)

30-30: LGTM! Title attributes improve discoverability.

Adding native hover tooltips to icon-only buttons enhances the user experience for mouse users.

Also applies to: 47-47, 56-56

frontend/src/components/ui/dialog.tsx (1)

68-76: Accessibility attributes correctly applied.

The title and aria-label additions improve both hover discoverability and screen reader support. While aria-label technically overrides the sr-only text, having both with matching values is harmless and ensures consistent behavior across different 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')

@rahulharpal1603
Copy link
Contributor

@Pritom2357 Please resolve the conflicts.

@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')

@rahulharpal1603 rahulharpal1603 added bug Something isn't working good first issue Good for newcomers UI labels Oct 23, 2025
@Pritom2357
Copy link
Contributor Author

@rahulharpal1603 done, please check

@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

@rahulharpal1603 rahulharpal1603 left a comment

Choose a reason for hiding this comment

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

@Pritom2357 Thanks!
Sorry for the delay though.

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

Labels

bug Something isn't working good first issue Good for newcomers hacktoberfest-accepted UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants