Skip to content

fix:style(a11y): add focus ring to the dropdown triggers#807

Open
IdrisGit wants to merge 1 commit intoTanStack:mainfrom
IdrisGit:fix-style-focus-state-search-dialog
Open

fix:style(a11y): add focus ring to the dropdown triggers#807
IdrisGit wants to merge 1 commit intoTanStack:mainfrom
IdrisGit:fix-style-focus-state-search-dialog

Conversation

@IdrisGit
Copy link
Copy Markdown

@IdrisGit IdrisGit commented Apr 2, 2026

Framework and Library selection dropdown in search modal has tab navigation but due to focus:outline-none there was no visual feedback, I have added a bit of padding and border radius to match with other buttons in the page and replaced focus:ouline-none with focus:ring-2.

search-dropdown-focus-fix-compressed.mp4

Summary by CodeRabbit

  • Style
    • Improved dropdown button appearance with enhanced spacing, rounded corners, and refined keyboard focus indicators.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 2, 2026

Deploy Preview for tanstack ready!

Name Link
🔨 Latest commit 3da941e
🔍 Latest deploy log https://app.netlify.com/projects/tanstack/deploys/69ce3d6e4444400008e29266
😎 Deploy Preview https://deploy-preview-807--tanstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 32 (🔴 down 17 from production)
Accessibility: 90 (no change from production)
Best Practices: 75 (🔴 down 8 from production)
SEO: 97 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

Updated className styling for dropdown trigger buttons in LibraryRefinement and FrameworkRefinement components within SearchModal.tsx. Added padding, rounded corners, and replaced focus outline with focus ring styling.

Changes

Cohort / File(s) Summary
Dropdown Button Styling
src/components/SearchModal.tsx
Updated className for two dropdown trigger buttons: added p-0.5 padding and rounded corners, replaced focus:outline-none with focus:ring-2 while retaining cursor-pointer and font-bold.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 With padding so snug and corners so round,
The buttons now shimmer with focus profound,
A ring of light dances where outlines once lay,
The SearchModal shines in a more modern way! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 a focus ring to dropdown triggers for improved accessibility (a11y).

✏️ 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/SearchModal.tsx (2)

644-663: ⚠️ Potential issue | 🟠 Major

Specify explicit focus ring color for consistent contrast.

Similar to the Library dropdown trigger, this button would benefit from an explicit ring color and offset to ensure consistent, accessible focus indicators across all themes.

♿ Proposed enhancement for better focus visibility
         <button
           type="button"
-          className="flex items-center gap-1 p-0.5 text-sm font-bold rounded cursor-pointer focus:ring-2"
+          className="flex items-center gap-1 p-0.5 text-sm font-bold rounded cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:ring-offset-2 dark:focus:ring-offset-gray-900"
         >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SearchModal.tsx` around lines 644 - 663, The focus ring on the
DropdownTrigger's button currently uses a generic focus:ring-2 without an
explicit color/offset; update the button inside DropdownTrigger (the element
with className including "focus:ring-2") to add an explicit ring color and
offset (e.g., add classes like focus:ring-[color] and focus:ring-offset-[size],
with a dark-mode alternative if needed) so the component (DropdownTrigger) has a
consistent, accessible focus indicator across themes.

570-586: ⚠️ Potential issue | 🟠 Major

Specify explicit focus ring color for consistent contrast.

The focus:ring-2 class provides a visible focus indicator, which is excellent for accessibility. However, without an explicit ring color, the contrast may be insufficient in some themes. Consider adding focus:ring-blue-500 (or another suitable color) and focus:ring-offset-2 for better visual separation and guaranteed WCAG 2.1 compliance.

♿ Proposed enhancement for better focus visibility
         <button
           type="button"
-          className="flex items-center gap-1 p-0.5 text-sm cursor-pointer font-bold rounded focus:ring-2"
+          className="flex items-center gap-1 p-0.5 text-sm cursor-pointer font-bold rounded focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:ring-offset-2 dark:focus:ring-offset-gray-900"
         >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SearchModal.tsx` around lines 570 - 586, The focus ring on the
button inside SearchModal.tsx (the button wrapped by DropdownTrigger that
renders currentLibrary) uses only focus:ring-2 which can lack contrast; update
the button's className to include an explicit ring color (e.g.,
focus:ring-blue-500 or another theme-appropriate color) and add
focus:ring-offset-2 to ensure clear separation from the background and
consistent WCAG-visible focus styling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/SearchModal.tsx`:
- Around line 644-663: The focus ring on the DropdownTrigger's button currently
uses a generic focus:ring-2 without an explicit color/offset; update the button
inside DropdownTrigger (the element with className including "focus:ring-2") to
add an explicit ring color and offset (e.g., add classes like focus:ring-[color]
and focus:ring-offset-[size], with a dark-mode alternative if needed) so the
component (DropdownTrigger) has a consistent, accessible focus indicator across
themes.
- Around line 570-586: The focus ring on the button inside SearchModal.tsx (the
button wrapped by DropdownTrigger that renders currentLibrary) uses only
focus:ring-2 which can lack contrast; update the button's className to include
an explicit ring color (e.g., focus:ring-blue-500 or another theme-appropriate
color) and add focus:ring-offset-2 to ensure clear separation from the
background and consistent WCAG-visible focus styling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f327d4b7-cc42-489e-929f-e91064301efc

📥 Commits

Reviewing files that changed from the base of the PR and between 1f56fce and 3da941e.

📒 Files selected for processing (1)
  • src/components/SearchModal.tsx

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