-
-
Notifications
You must be signed in to change notification settings - Fork 311
fix: improve Sort By dropdown styling consistency #2363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve Sort By dropdown styling consistency #2363
Conversation
Summary by CodeRabbit
WalkthroughRestyles the Sort By UI in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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 (1)
frontend/src/components/SortBy.tsx (1)
27-28: Simplify redundant background declarations.The trigger classes contain multiple redundant
bg-transparentdeclarations across different states (hover, focus, data attributes), culminating in an!importantflag. This complexity suggests difficulties overriding default component styles.Consider investigating which specific state is causing the background issue and address it more surgically. If the library applies backgrounds at high specificity, document this in a code comment rather than using multiple overrides plus
!important.Additionally, verify that removing
focus:outline-noneandfocus:ring-0doesn't harm keyboard navigation accessibility, especially since no visible focus indicator appears to be provided for the trigger.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/components/SortBy.tsx(3 hunks)
🔇 Additional comments (3)
frontend/src/components/SortBy.tsx (3)
18-18: LGTM! Container styling is well-structured.The outer container styling provides good visual hierarchy with appropriate borders, shadows, and smooth transitions. The light/dark mode color choices are consistent and enhance the overall user experience.
70-70: LGTM! Button styling includes proper accessibility features.The sort order button has well-defined hover, focus, and active states with appropriate focus rings for keyboard navigation. The styling is consistent with the design system and provides good visual feedback.
75-80: LGTM! Icon colors provide good contrast.The icon color updates maintain consistency between both sort direction icons and provide appropriate contrast in both light and dark modes.
kasya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mrkeshav-05 for working on this!
Left some comments.
Also, please run make check and commit suggested changes - this is required by contributing guidelines in OWASP Nest project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@kasya Thank you for the review! I've addressed the feedback:
screenshot of the improved style:
Code is ready for review. |
frontend/src/components/SortBy.tsx
Outdated
| <div className="flex items-center gap-2"> | ||
| {/* Sort Attribute Dropdown */} | ||
| <div className="inline-flex h-12 items-center rounded-lg bg-gray-200 dark:bg-[#323232]"> | ||
| <div className="inline-flex h-12 items-center rounded-lg border border-gray-300 bg-gray-100 px-3 shadow-sm transition-all duration-200 hover:shadow-md dark:border-gray-600 dark:bg-[#323232]"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the classes seem right, but we should have the same padding that we see on the frontend and not just the classes.
I don't think these are the same padding on right and left side 🤔 Clearly there's much more space after the caret on the right.
Which means that these classes should be different:
| <div className="inline-flex h-12 items-center rounded-lg border border-gray-300 bg-gray-100 px-3 shadow-sm transition-all duration-200 hover:shadow-md dark:border-gray-600 dark:bg-[#323232]"> | |
| <div className="inline-flex h-12 items-center rounded-lg border border-gray-300 bg-gray-100 pl-3 shadow-sm transition-all duration-200 hover:shadow-md dark:border-gray-600 dark:bg-[#323232]"> |
To only keep the padding (we don't need padding after caret to match the left side).
Before and after:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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
⛔ Files ignored due to path filters (3)
backend/poetry.lockis excluded by!**/*.lockdocs/poetry.lockis excluded by!**/*.lockfrontend/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
README.md(1 hunks)backend/pyproject.toml(1 hunks)frontend/docker/Dockerfile.e2e.test(1 hunks)frontend/package.json(4 hunks)frontend/src/components/SortBy.tsx(3 hunks)
✅ Files skipped from review due to trivial changes (2)
- frontend/docker/Dockerfile.e2e.test
- README.md
🔇 Additional comments (1)
backend/pyproject.toml (1)
45-47: Slack SDK bump is compatible with slack-bolt 1.22.0
slack-bolt1.22.0 requiresslack_sdk>=3.33.5,<4, so^3.37.0is valid; no changes needed.Likely an incorrect or invalid review comment.
3e399f6 to
4bbd5f1
Compare
- Remove blue outline and inconsistent hover backgrounds - Add proper focus/active states styles to match the design system - Improve light/dark mode theme integration - Fix trigger background blending issues Fixes OWASP#1372
4bbd5f1 to
bdf0957
Compare
|
There was a problem hiding this 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
♻️ Duplicate comments (1)
frontend/src/components/SortBy.tsx (1)
26-27: Restore accessible focus indicator on the trigger.The trigger removes the default focus outline (
focus:outline-none focus:ring-0) without providing a replacement, which breaks keyboard accessibility. This issue was previously flagged but remains unresolved.Add a custom focus-visible indicator such as
data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-gray-300 dark:data-[focus-visible=true]:ring-gray-500to ensure keyboard users can see which element has focus.Apply this diff to add accessible focus styling:
trigger: - 'bg-transparent data-[hover=true]:bg-transparent focus:outline-none focus:ring-0 border-none shadow-none text-nowrap w-32 min-h-8 h-8 text-sm font-medium text-gray-800 dark:text-gray-200 hover:text-gray-900 dark:hover:text-gray-100 transition-all duration-0', + 'bg-transparent data-[hover=true]:bg-transparent focus:outline-none focus:ring-0 data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-gray-300 dark:data-[focus-visible=true]:ring-gray-500 data-[focus-visible=true]:ring-offset-2 border-none shadow-none text-nowrap w-32 min-h-8 h-8 text-sm font-medium text-gray-800 dark:text-gray-200 hover:text-gray-900 dark:hover:text-gray-100 transition-all duration-0',
🧹 Nitpick comments (1)
frontend/src/components/SortBy.tsx (1)
27-27: Remove redundanttransition-allwhen usingduration-0. Thetransition-allutility combined withduration-0effectively disables transitions—droptransition-allif no transitions are desired.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/components/SortBy.tsx(3 hunks)
🔇 Additional comments (4)
frontend/src/components/SortBy.tsx (4)
18-18: LGTM!The container styling is well-structured with appropriate borders, shadows, hover effects, and comprehensive dark mode support. The use of
pl-3(left padding only) correctly addresses the padding balance issue discussed in previous reviews.
44-46: Excellent! Hover behavior is now consistent.The SelectItem styling now uses
hover:bg-transparent dark:hover:bg-transparent, ensuring consistent hover behavior across light and dark themes. This successfully addresses the previous review feedback.The comprehensive state handling for focus, selection, and hover states with appropriate transitions demonstrates good attention to detail.
65-65: LGTM!The sort order button styling is excellent with proper focus ring (
focus:ring-2 focus:ring-gray-300 dark:focus:ring-gray-500) that maintains accessibility while removing the default outline. The comprehensive hover, transition, and dark mode support is well-implemented.
68-76: LGTM!The FontAwesome icon color updates (
text-gray-600 dark:text-gray-300) provide excellent consistency across light and dark themes. The styling is appropriately applied to both ascending and descending order icons.
kasya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!











Fixes #1372
Before Changes:
After Changes: