Skip to content

Fixed issue #337#342

Open
ktan-wolf wants to merge 1 commit intoapsinghdev:mainfrom
ktan-wolf:main
Open

Fixed issue #337#342
ktan-wolf wants to merge 1 commit intoapsinghdev:mainfrom
ktan-wolf:main

Conversation

@ktan-wolf
Copy link

@ktan-wolf ktan-wolf commented Feb 18, 2026

fixed the alignment issue in the sidebar

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced keyboard navigation with explicit Enter and Space key support for sidebar controls.
    • Improved accessibility features including ARIA labels and attributes for assistive technology support.
  • Style

    • Refined visual alignment and layout of sidebar elements in collapsed state.
    • Updated conditional styling for the feature request functionality based on sidebar expansion state.

@vercel
Copy link

vercel bot commented Feb 18, 2026

@ktan-wolf is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

Modified the Sidebar component to render the Pro section and "Request a feature" item differently when collapsed, adding keyboard event handling (Enter/Space) and ARIA attributes. Adjusted styling for left alignment in collapsed state while maintaining color behavior.

Changes

Cohort / File(s) Summary
Sidebar Component Updates
apps/web/src/components/dashboard/Sidebar.tsx
Reworked collapsed Pro section as a clickable div with keyboard support and ARIA attributes. Implemented conditional rendering for "Request a feature" based on collapsed state. Adjusted padding from center-aligned to left-aligned (pl-3).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 A sidebar refined, now keyboard-aware,
With ARIA labels, oh how we care!
Collapsed or expanded, the features request,
Accessibility first—this change is the best! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title 'Fixed issue #337' is vague and does not clearly describe the actual change made to the sidebar alignment. While it references an issue, it provides no meaningful information about what was fixed. Update the title to be more descriptive, such as 'Fix sidebar alignment in collapsed Pro section' or 'Rework Pro section rendering for improved collapsed state styling'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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
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 (2)
apps/web/src/components/dashboard/Sidebar.tsx (2)

468-468: collapsed={isCollapsed} is always false in this branch — remove it

This ternary's else branch only executes when !isCollapsed, so collapsed={isCollapsed} is always false and can be omitted (the prop already defaults to false in SidebarItem).

🧹 Proposed fix
          <SidebarItem
            itemName="Request a feature"
            onclick={reqFeatureHandler}
            icon={<SparklesIcon className="size-5" />}
-           collapsed={isCollapsed}
          />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/components/dashboard/Sidebar.tsx` at line 468, In Sidebar.tsx
remove the redundant collapsed={isCollapsed} prop from the branch where
!isCollapsed is guaranteed (it will always be false there); update the JSX that
renders SidebarItem to omit the collapsed prop in that branch so SidebarItem
relies on its default prop value, and ensure only the branch that needs to force
collapsed explicitly passes collapsed (or pass collapsed only when isCollapsed
is true).

447-470: Fix the root cause in SidebarItem.tsx to eliminate the duplicated collapsed div

The new collapsed div (lines 447–462) is structurally identical to the collapsed Pro section div (lines 422–436) — same className, role, tabIndex, and onKeyDown pattern. The root issue is that SidebarItem uses justify-center when collapsed, so it was bypassed instead of fixed. A one-line fix in SidebarItem.tsx lets you drop the entire conditional and the duplicated markup:

In apps/web/src/components/sidebar/SidebarItem.tsx:

  className={`w-full h-[44px] flex items-center rounded-md cursor-pointer transition-colors px-2 ${
-   collapsed ? "justify-center" : "gap-3 pl-3"
+   collapsed ? "justify-start pl-3" : "gap-3 pl-3"
  } hover:bg-dash-hover group`}

Then in Sidebar.tsx:

♻️ Proposed simplification in Sidebar.tsx
-        {isCollapsed ? (
-          <div
-            onClick={reqFeatureHandler}
-            className="w-full h-[44px] flex items-center justify-start pl-3 rounded-md cursor-pointer transition-colors hover:bg-dash-hover group"
-            role="button"
-            tabIndex={0}
-            aria-label="Request a feature"
-            onKeyDown={(e) => {
-              if (e.key === "Enter" || e.key === " ") {
-                e.preventDefault();
-                reqFeatureHandler();
-              }
-            }}
-          >
-            <SparklesIcon className="size-5 text-text-secondary group-hover:text-text-primary transition-colors" />
-          </div>
-        ) : (
-          <SidebarItem
-            itemName="Request a feature"
-            onclick={reqFeatureHandler}
-            icon={<SparklesIcon className="size-5" />}
-            collapsed={isCollapsed}
-          />
-        )}
+        <SidebarItem
+          itemName="Request a feature"
+          onclick={reqFeatureHandler}
+          icon={<SparklesIcon className="size-5" />}
+          collapsed={isCollapsed}
+        />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/components/dashboard/Sidebar.tsx` around lines 447 - 470, Update
SidebarItem.tsx so its collapsed render matches the standalone collapsed div
instead of using justify-center: when props.collapsed is true, render a
focusable div that uses the same className ("w-full h-[44px] flex items-center
justify-start pl-3 rounded-md cursor-pointer transition-colors
hover:bg-dash-hover group"), role="button", tabIndex={0}, aria-label from
itemName (e.g., "Request a feature"), call the passed onclick prop onClick, and
implement the same onKeyDown handler that triggers onclick on Enter or Space;
also ensure the icon prop gets the SparklesIcon classes ("size-5
text-text-secondary group-hover:text-text-primary transition-colors") so the
collapsed appearance matches the duplicated div. This one-line behavior change
in SidebarItem lets you remove the conditional duplicated markup in Sidebar.tsx
and always render <SidebarItem onclick={reqFeatureHandler}
collapsed={isCollapsed} itemName="Request a feature" icon={...} />.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/src/components/dashboard/Sidebar.tsx`:
- Around line 464-469: The SidebarItem component lacks keyboard accessibility:
update the SidebarItem component (the component that receives the onclick prop)
so its interactive root element includes role="button", tabIndex={0}, and an
onKeyDown handler that invokes the existing onclick prop when the user presses
Enter or Space; ensure the handler prevents default where appropriate and that
any aria-label or accessible name is preserved for both collapsed and expanded
states so keyboard users can activate the item the same way as mouse users.

---

Nitpick comments:
In `@apps/web/src/components/dashboard/Sidebar.tsx`:
- Line 468: In Sidebar.tsx remove the redundant collapsed={isCollapsed} prop
from the branch where !isCollapsed is guaranteed (it will always be false
there); update the JSX that renders SidebarItem to omit the collapsed prop in
that branch so SidebarItem relies on its default prop value, and ensure only the
branch that needs to force collapsed explicitly passes collapsed (or pass
collapsed only when isCollapsed is true).
- Around line 447-470: Update SidebarItem.tsx so its collapsed render matches
the standalone collapsed div instead of using justify-center: when
props.collapsed is true, render a focusable div that uses the same className
("w-full h-[44px] flex items-center justify-start pl-3 rounded-md cursor-pointer
transition-colors hover:bg-dash-hover group"), role="button", tabIndex={0},
aria-label from itemName (e.g., "Request a feature"), call the passed onclick
prop onClick, and implement the same onKeyDown handler that triggers onclick on
Enter or Space; also ensure the icon prop gets the SparklesIcon classes ("size-5
text-text-secondary group-hover:text-text-primary transition-colors") so the
collapsed appearance matches the duplicated div. This one-line behavior change
in SidebarItem lets you remove the conditional duplicated markup in Sidebar.tsx
and always render <SidebarItem onclick={reqFeatureHandler}
collapsed={isCollapsed} itemName="Request a feature" icon={...} />.

Comment on lines +464 to +469
<SidebarItem
itemName="Request a feature"
onclick={reqFeatureHandler}
icon={<SparklesIcon className="size-5" />}
collapsed={isCollapsed}
/>
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find SidebarItem component
find apps/web/src/components -name "*SidebarItem*" -type f

Repository: apsinghdev/opensox

Length of output: 109


🏁 Script executed:

#!/bin/bash
# Search for tabIndex, onKeyDown, role attributes in sidebar components
rg -n "tabIndex|onKeyDown|role=" apps/web/src/components/sidebar/ -A 2 -B 2

Repository: apsinghdev/opensox

Length of output: 44


🏁 Script executed:

#!/bin/bash
# Also check the dashboard components directory for SidebarItem
find apps/web/src/components -path "*dashboard*" -name "*SidebarItem*" -type f

Repository: apsinghdev/opensox

Length of output: 44


🏁 Script executed:

#!/bin/bash
# Read the SidebarItem component
cat -n apps/web/src/components/sidebar/SidebarItem.tsx

Repository: apsinghdev/opensox

Length of output: 1363


SidebarItem component lacks keyboard accessibility

The component has only an onClick handler with no role="button", tabIndex, or onKeyDown attributes. Both the collapsed and expanded states are equally inaccessible to keyboard users, violating the guideline requiring accessibility features on all interactive elements.

Update SidebarItem.tsx to add role="button", tabIndex={0}, and an onKeyDown handler (to trigger onclick on Enter/Space keys).

Based on learnings: "Implement accessibility features on interactive elements (e.g., tabindex='0', aria-label, onClick, onKeyDown)"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/components/dashboard/Sidebar.tsx` around lines 464 - 469, The
SidebarItem component lacks keyboard accessibility: update the SidebarItem
component (the component that receives the onclick prop) so its interactive root
element includes role="button", tabIndex={0}, and an onKeyDown handler that
invokes the existing onclick prop when the user presses Enter or Space; ensure
the handler prevents default where appropriate and that any aria-label or
accessible name is preserved for both collapsed and expanded states so keyboard
users can activate the item the same way as mouse users.

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

Comments