fix(desktop): change sidebar project dropdown to open downward#1170
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughRemoved explicit Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectHeader.tsx (1)
366-379:⚠️ Potential issue | 🟠 MajorIncorrect
aria-expandedattribute on dropdown trigger.The
aria-expanded={!isCollapsed}reflects the project section's collapse state, not whether the dropdown menu is open. This is misleading for assistive technologies. TheDropdownMenuTriggercomponent automatically manages its ownaria-expandedstate based on the menu's open/closed state—remove this manual override.🛠️ Proposed fix
<button type="button" aria-label="Project actions" - aria-expanded={!isCollapsed} className="p-1 rounded hover:bg-muted transition-colors shrink-0 ml-1" >
🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectHeader.tsx (1)
189-221: Consider extracting shared color picker rendering logic.The
dropdownColorPickerSubmenuandcolorPickerSubmenu(lines 156-187) share identical rendering logic for color items. You could extract the common item rendering into a reusable function.♻️ Optional: Extract shared rendering
// Shared color item renderer const renderColorItems = (MenuItem: typeof ContextMenuItem | typeof DropdownMenuItem) => PROJECT_COLORS.map((color) => { const isDefault = color.value === PROJECT_COLOR_DEFAULT; return ( <MenuItem key={color.value} onSelect={() => handleColorChange(color.value)} className="flex items-center gap-2" > <span className={cn( "size-3 rounded-full border", isDefault ? "border-border bg-muted" : "border-border/50", )} style={isDefault ? undefined : { backgroundColor: color.value }} /> <span>{color.name}</span> {projectColor === color.value && ( <span className="ml-auto text-xs text-muted-foreground">✓</span> )} </MenuItem> ); });
Remove side="right" from the collapsed sidebar project tooltip so it opens downward (default) instead of to the side.
8df3a67 to
9536002
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
ContextMenu(right-click triggered, opens at cursor position to the side) into aDropdownMenu(click-triggered on the chevron, opens downward below the trigger)DropdownMenuimports and a dropdown version of the color picker submenu usingDropdownMenuSubcomponentsside="bottom" align="end"so it opens downward from the chevron triggerContextMenu)Test plan
Summary by CodeRabbit
Refactor
Bug Fix